I am facing an issue with Worklight Push Notification.
I followed all steps of Worklight 5.0.5, Module_41_-_Push_Notifications.
PDF file, and did Push demo.
I am facing an error stating:
[ERROR] Can't subscribe, notification token is not updated on the
server
Although on the console it does show the device ID.
My assumption is WL.Client.Push.onReadyToSubscribe not getting fired.
Someone had similar issues.
https://www.ibm.com/developerworks/forums/thread.jspa?threadID=456501
I have set
<pushSender password="Your_Password"/>
and re-generated and deployed App multiple times but no benefit.
Any help or suggestion are welcome.
Environment:
WL 5.0.5 & 5.0.6
Xcode 4.2
iPhone (iOS 5.1 and 6.1)
I tried once again on local mac, testing via iPhone 4 , iOS 5.1. when running through device and connecting to Studio jetty. I am getting below.
Mar 27 11:23:49 Appsdev-iPhone PushApplication[211] <Warning>: Applications are expected to have a root view controller at the end of application launch
Mar 27 11:23:49 Appsdev-iPhone PushApplication[211] <Warning>: Web resources integrity test is disabled.
Mar 27 11:23:49 Appsdev-iPhone kernel[0] <Debug>: launchd[211] Builtin profile: container (sandbox)
Mar 27 11:23:49 Appsdev-iPhone kernel[0] <Debug>: launchd[211] Container: /private/var/mobile/Applications/5DA837C4-F039-4795-9509-C98383E40C68 [69] (sandbox)
Mar 27 11:23:49 Appsdev-iPhone PushApplication[211] <Warning>: Multi-tasking -> Device: YES, App: YES
Mar 27 11:23:51 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] ondeviceready event dispatched
Mar 27 11:23:51 Appsdev-iPhone PushApplication[211] <Warning>: {
appVersionPref = "1.0";
freeSpace = 14291787776;
wlSkinLoaderChecksum = "(null)";
wlSkinName = default;
}
Mar 27 11:23:51 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] wlclient init started
Mar 27 11:23:51 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] Read cookies: null
Mar 27 11:23:51 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] CookieMgr read cookies: {}
Mar 27 11:23:51 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] Request [http://172.20.10.2:8080/apps/services/api/PushApplication/iphone/init]
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] Request [login]
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] Request [http://172.20.10.2:8080/apps/services/api/PushApplication/iphone/init]
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] Request [http://172.20.10.2:8080/apps/services/api/PushApplication/iphone/init]
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] Clearing notification subscriptions.
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] Send new server notification token id.
Mar 27 11:24:12 Appsdev-iPhone SpringBoard[15] <Warning>: No valid 'aps-environment' entitlement string found for application 'PushApplication': (null). Notifications will not be delivered.
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] response [http://172.20.10.2:8080/apps/services/api/PushApplication/iphone/init] success: /*-secure-
{"userPrefs":{},"WL-Authentication-Success":{"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"PushAppRealm":{"userId":"aahad","attributes":{},"isUserAuthenticated":1,"displayName":"aahad"},"wl_antiXSRFRealm":{"userId":"3l6ap8g9t4h9uk5rb1fmqfok15","attributes":{},"isUserAuthenticated":1,"displayName":"3l6ap8g9t4h9uk5rb1fmqfok15"},"wl_deviceNoProvisioningRealm":{"userId":"57B167E4-1258-4AD7-9DA1-92DC66A0451E","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData#6a76de98"},"isUserAuthenticated":1,"displayName":"57B167E4-1258-4AD7-9DA1-92DC66A0451E"}},"notificationSubscriptionState":{},"gadgetProps":{"directUpdate":{"updateUnpackedSize":1014255,"availableSkins":["default"],"checksum":4077143359,"updateSize":290080},"ENVIRONMENT":"iphone"},"userInfo":{"wl_authenticityRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"SampleAppRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"PushAppRealm":{"userId":"aahad","attributes":{},"isUserAuthenticated":1,"displayName":"aahad"},"wl_antiXSRFRealm":{"userId":"3l6ap8g9t4h9uk5rb1fmqfok15","attributes":{},"isUserAuthenticated":1,"displayName":"3l6ap8g9t4h9uk5rb1fmqfok15"},"WorklightConsole":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_deviceAutoProvisioningRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_deviceNoProvisioningRealm":{"userId":"57B167E4-1258-4AD7-9DA1-92DC66A0451E","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData#6a76de98"},"isUserAuthenticated":1,"displayName":"57B167E4-1258-4AD7-9DA1-92DC66A0451E"},"myserver":{"userId":"aahad","attributes":{},"isUserAuthenticated":1,"displayName":"aahad"},"wl_anonymousUserRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null}}}*/
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] wlclient connect success
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] before: app init onSuccess
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] after: app init onSuccess
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [LOG] wlclient init success
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: Could not register for remote notifications: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0xfeafba0 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
Mar 27 11:24:12 Appsdev-iPhone PushApplication[211] <Warning>: [ERROR] Error while trying to retrieve device token from the mobile operating system.
see attached snapshots.
The steps to generate APNS:
Logged on to Apple Account select App ID ->Configure -> Enable Push
Selected Development Push SSL Certificate
Generated a new CSR first and then got a Certificate
Double clicked the certificate and from Keychain selected this new Certificate and its Private key, and then right-click and Export and saved as
apns-certificate-sandbox.p12
copied into Worklight, on the root of App folder at the same level of application-descriptor.xml
provided pushSender password and given securityTest
Thanks
#Idan,
Its resolved now. There were two reasons:
After copying APNS certificate inside the worklight App folder, you have to re-generate & deploy all. You must then deploy wlapp on WL consle....... that is was NOT doing.
I used a wrong custom security realm for iPhone environment that blocked the WL Server to response back to device.
Hope this info will help others facing similar issues.
Thanks
Make sure that you have:
Added the iPhone environment to application-descriptor.xml (using the Worklight-provided wizard)
Added the mobile securityTest to the iphone environment (see how it is done for the Android environment; copy it)
Placed the .p12 certificate in the application folder (same level as the environment folders)
That the name of the certificate is "apns-certificate-sandbox.p12" (for development) or "apns-certificate-production.p12" (for production)
Added the correct password in the pushSender element
After logging-in in the application, you should get an alert stating that you are able to subscribe.
To make sure you have properly setup your development environment, follow this guide: Understanding and setting up artifacts required to use iOS devices and Apple Push Notifications services (APNS) in development environment
Related
I have looked at other thread on same topic but couldn't get any answers there and hence created a new thread.
I am running into subjected error. It started when I upgraded my iPad to iOS 9.3.5 and it happens only on UITextField field. Here are logs but not able to find the root cause. This is occurring in Xamarin.iOS 10.2.1.5 which is latest and greatest.
Nov 26 13:16:09 rb-iPad SpringBoard[46] <Warning>: HW kbd: Failed to set (null) as keyboard focus
Nov 26 13:16:09 rb-iPad SpringBoard[46] <Warning>: HW kbd: Failed to set (null) as keyboard focus
Nov 26 13:16:10 rb-iPad SpringBoard[46] <Warning>: Unable to get short BSD proc info for 219: No such process
Nov 26 13:16:10 rb-iPad SpringBoard[46] <Warning>: Unable to get short BSD proc info for 219: No such process
Nov 26 13:16:10 rb-iPad SpringBoard[46] <Warning>: Unable to get short BSD proc info for 219: No such process
Nov 26 13:16:10 rb-iPad SpringBoard[46] <Warning>: Application 'UIKitApplication:com.safetytracker.app[0xbad8]' exited voluntarily.
Nov 26 13:16:10 rb-iPad UserEventAgent[23] <Warning>: 89823664133: id=com.safetytracker.app pid=219, state=0
Nov 26 13:16:10 rb-iPad mobile_installation_proxy[194] <Error>: 0x1f197000 handle_connection: Could not receive request from host.
Nov 26 13:16:10 rb-iPad com.apple.debugserver-#(#)PROGRAM:debugserver PROJECT:debugserver-340.3.124[218] <Warning>: 1 +0.000000 sec [00da/0a0b]: error: ::read ( 6, 0x64dd7c, 1024 ) => 0 err = No such file or directory (0x00000002)
Nov 26 13:16:10 rb-iPad com.apple.debugserver-#(#)PROGRAM:debugserver PROJECT:debugserver-340.3.124 [218] <Warning>: Exiting.
Has anyone faced the same issue? Not sure what am I going wrong.
This turned out to be an issue with code. But surprisingly code was working fine until I upgraded to latest build.
Lesson learnt, debug the code as you never know what part of code will start failing after you upgrade the Xamarin.
The device is iPhone 6s Plus with iOS 9.2. Using Titanium Studio, when I run in debug mode and stepping through code, the app runs fine. However, when I simply "run" it (device connected to laptop via USB) or install the .ipa file in adhoc distribution, the app crashes as soon as it is launched. There is absolutely no log generated in Titanium when "run". And there is little to no relevant information in Xcode too when the installed .ipa is run. Here is the log from Xcode:
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus SpringBoard[58] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus SpringBoard[58] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus securityd[96] <Error>: secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus securityd[96] <Error>: secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus amfid[178] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus kernel[0] <Notice>: xpcproxy[311] Container: /private/var/mobile/Containers/Data/Application/8A3B415C-2259-A7NA-8XXD-8X5XFXCAJBDK (sandbox)
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus MySampleApp[311] <Warning>: [DEBUG] Reading stylesheet from: /var/mobile/Containers/Bundle/Application/H3POBLF9-PB0N-1KF5-4RXY-EEDRD90GC79X/MySampleApp.app/stylesheet.plist
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus iap2d[176] <Warning>: process com.mysampleco.mysampleapp is now running the foreground
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus UserEventAgent[26] <Warning>: Tracking com.mysampleco.mysampleapp (via activity)
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus MySampleApp[311] <Warning>: [INFO] MySampleApp/1.0.1 (5.2.0.384775e)
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus MySampleApp[311] <Warning>: [DEBUG] Loading: /var/mobile/Containers/Bundle/Application/H3POBLF9-PB0N-1KF5-4RXY-EEDRD90GC79X/MySampleApp.app/app.js, Resource: app_js
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus kernel[0] <Notice>: Sandbox: MySampleApp(311) deny(1) sysctl-read kern.proc.all.0
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus kernel[0] <Notice>: Sandbox: MySampleApp(311) deny(1) process-info-pidinfo 0
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus kernel[0] <Notice>: Sandbox: MySampleApp(311) deny(1) sysctl-read kern.proc.pid.0
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus mediaserverd[28] <Notice>: '' com.mysampleco.mysampleapp(pid = 311) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus SpringBoard[58] <Warning>: HW kbd: Failed to set (null) as keyboard focus
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus mediaserverd[28] <Notice>: 'FigPlayer - 34' (pid = 34) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus com.apple.xpc.launchd[1] (UIKitApplication:com.mysampleco.mysampleapp[0x72dd][311]) <Warning>: Service exited with abnormal code: 1
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus SpringBoard[58] <Warning>: Application 'UIKitApplication:com.mysampleco.mysampleapp[0x72dd]' exited voluntarily.
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus iap2d[176] <Warning>: process com.mysampleco.mysampleapp is now switching to other state
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus iap2d[176] <Warning>: process com.mysampleco.mysampleapp is now terminated
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus UserEventAgent[26] <Warning>: 85324450686: id=com.mysampleco.mysampleapp pid=311, state=0
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus SpringBoard[58] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
I've searched through other posts, some of whom point to "Javascript Minification" (which I turned off but still got the crash) and some talk about "Fastest, Smallest [-Os]" for Release in Code Generation section of Xcode's Build setting (which I don't know how to control since I'm using Appcelerator Titanium to build the app). Several others discuss specific code issues as revealed by the log. Since I get nothing in the log files that I can tell of significance, I'm not sure where to look.
Any help is appreciated.
UPDATE on March 21, 2016:
It took me a while to figure out the culprit. Here are the steps to reproduce the issue:
1) In Titanium Studio, create a new Mobile App project using Alloy Default template.
2) Run the newly created project as-is to a USB attached iPhone 6s Plus (or probably ANY ios device).
3) Click on the app icon on the device and the app will launch just fine with Hello World on the screen.
4) Now go to the TiApp.xml file and edit it by adding the following parameter:
<property name="appc-sourcecode-encryption-policy">embed</property>
5) Now run the modified project to the USB attached device.
6) Open the app and you will notice that it crashes right after the splash screen shows briefly.
It seems the property above does not work properly. Opened JIRA ticket AC-3389.
It looks like a provisioning issue. Check this thread which deals with a similar error.
If that does not help, please provide some more details like sample code and detailed crash logs (full trace-log). Thanks!
I just released my latest PhoneGap build to the app store and now when I download it, it fails to load, only showing the splash screen and spinner. I'm not sure how to collect an error, other than running it with the console open. Also there are no crash logs under organizer.
I also checked the entitlements and aps-enviroment was on production.
The only error is this and I can't figure out what it means: The 'Passive' connection 'MYAPP' access to protected services is denied.
I gathered all of the certificates (I hope) and Push notifications are enabled on the App ID on the dev center. Everything is working fine on my local builds.
There is from the console on startup:
Apr 3 17:38:42 Adams-iPhone kernel[0] <Debug>: launchd[3035] Container: /private/var/mobile/Applications/D79CBF76-D2DE-49E2-8021-BDA8EFB7EC0E (sandbox)
Apr 3 17:38:42 Adams-iPhone backboardd[31] <Error>: HID: The 'Passive' connection 'MYAPP' access to protected services is denied.
Apr 3 17:38:42 Adams-iPhone MYAPP[3035] <Warning>: Multi-tasking -> Device: YES, App: YES
Apr 3 17:38:42 Adams-iPhone MYAPP[3035] <Warning>: Unlimited access to network resources
Apr 3 17:38:42 Adams-iPhone MYAPP[3035] <Warning>: [CDVTimer][splashscreen] 10.690987ms
Apr 3 17:38:42 Adams-iPhone MYAPP[3035] <Warning>: [CDVTimer][splashscreen] 0.021994ms
Apr 3 17:38:42 Adams-iPhone MYAPP[3035] <Warning>: [CDVTimer][TotalPluginStartup] 12.279987ms
Apr 3 17:38:42 Adams-iPhone wifid[40] <Notice>: WiFi:[418264722.812325]: Client itunesstored set type to normal application
Apr 3 17:38:42 Adams-iPhone wifid[40] <Notice>: WiFi:[418264722.812654]: BG Application: Not Present, BG Daemon: Present. Daemons: networkd sharingd SiriViewService apsd lockdownd assistantd
Apr 3 17:38:42 Adams-iPhone MYAPP[3035] <Warning>: Resetting plugins due to page load.
Apr 3 17:38:42 Adams-iPhone wifid[40] <Notice>: WiFi:[418264722.892555]: WiFi unquiescing requested by "locationd"
Apr 3 17:38:42 Adams-iPhone MYAPP[3035] <Warning>: appDel.globalToken :<123 456 token here 789>
Apr 3 17:38:42 Adams-iPhone MYAPP[3035] <Warning>: Finished load of: file:///var/mobile/Applications/D79CBF76-D2DE-49E2-8021-BDA8EFB7EC0E/MYAPP.app/www/index.html
Pause in text streaming, app splash screen is just spinning
Apr 3 17:38:52 Adams-iPhone mstreamd[3033] <Notice>: (Note ) mstreamd: Not monitoring for external power.
Apr 3 17:38:52 Adams-iPhone mstreamd[3033] <Notice>: (Note ) PS: Media stream daemon stopping.
Apr 3 17:38:52 Adams-iPhone mstreamd[3033] <Notice>: (Note ) AS: <MSIOSAlbumSharingDaemon: 0x14c6213d0>: Shared Streams daemon has shut down.
Apr 3 17:38:52 Adams-iPhone mstreamd[3033] <Notice>: (Warn ) mstreamd: mstreamd shutting down.
Apr 3 17:38:52 Adams-iPhone mstreamd[3037] <Notice>: (Note ) mstreamd: mstreamd starting up.
Apr 3 17:38:52 Adams-iPhone mstreamd[3037] <Notice>: (Note ) PS: Media stream daemon starting...
Apr 3 17:38:56 Adams-iPhone wifid[40] <Notice>: WiFi:[418264736.223622]: WiFi unquiescing requested by "locationd"
Apr 3 17:39:32 Adams-iPhone mstreamd[3037] <Notice>: (Note ) mstreamd: Not monitoring for external power.
Apr 3 17:39:32 Adams-iPhone mstreamd[3037] <Notice>: (Note ) PS: Media stream daemon stopping.
Apr 3 17:39:32 Adams-iPhone mstreamd[3037] <Notice>: (Note ) AS: <MSIOSAlbumSharingDaemon: 0x13ce433b0>: Shared Streams daemon has shut down.
Apr 3 17:39:32 Adams-iPhone mstreamd[3037] <Notice>: (Warn ) mstreamd: mstreamd shutting down.
Apr 3 17:39:32 Adams-iPhone mstreamd[3038] <Notice>: (Note ) mstreamd: mstreamd starting up.
Apr 3 17:39:32 Adams-iPhone mstreamd[3038] <Notice>: (Note ) PS: Media stream daemon starting...
Apr 3 17:39:46 Adams-iPhone wifid[40] <Notice>: WiFi:[418264786.075727]: WiFi unquiescing requested by "locationd"
Apr 3 17:39:57 Adams-iPhone wifid[40] <Notice>: WiFi:[418264797.335924]: WiFi unquiescing requested by "locationd"
Also some diffs from the additions for push: (taken from this post:)
platforms/ios/Blonk/Classes/AppDelegate.m
#synthesize globalToken = _globalToken;
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
// Let the device know we want to receive push notifications
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
CGRect screenBounds = [[UIScreen mainScreen] bounds];
#if __has_feature(objc_arc)
## -87,10 +94,28 #
// TODO dump device token to console
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
// NSLog(#"My token is: %#", deviceToken);
_globalToken = deviceToken;
// NSString* jsString = [NSString stringWithFormat:#"alert('push:ios %#')", deviceToken];
// [self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
}
// Dump error message
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
NSLog(#"Failed to get token, error: %#", error);
}
platforms/ios/Blonk/Classes/MainViewController.m
#import "AppDelegate.h"
AppDelegate * appDel = (AppDelegate *) [[UIApplication sharedApplication] delegate];
NSLog(#"appDel.globalToken :%#", appDel.globalToken);
NSString* jsString = [NSString stringWithFormat:#"__IOS_TOKEN__ = '%#';", appDel.globalToken];
[theWebView stringByEvaluatingJavaScriptFromString:jsString];
The problem ended up being the code signing profile.
I upgraded Xcode to 5.1 which broke PhoneGap when building for the 5s. I downgraded to 5.0 and the release code signing was switched back to 'developer'. At the time I was not using TestFlight to make sure the binary I was submitting was running. I naively assumed the dev build was the same as the app store build. I was able to replicate the white screen problem using the bad build on TestFlight, and the new build with the proper profile worked on TestFlight, as well as from the app store.
If you haven't already, request an expedited review once you have a working build (I would test on TestFlight).
I'm developing a MDM solutioin for my own organization. Created an iOS MDM testing server using python mentioned by imdmtools, generate push certs according to softthinker.
Here's the cert details:
Vendor: has an Enterprise Developer Program, the "MDM CSR" type certificate can be found in Apple developer center, downloaded as "mdm.cer".
Customer: same as Vendor, I generated in Windows 2008 IIS where my MDM server was hosted. The customer CSR was generated by the method mentioned by support.citrix.com/proddocs/topic/xmob-dm-8/xmob-dm-connect-create-p12-apns-iis-tsk.html.
The cert file has been created successfully, could be imported into keychain and exported in p12 format. I converted it into PEM format:
Locate the certificate in Keychain Access
Export to a .p12 file
Convert to .pem
openssl pkcs12 -in OrigPushCert.p12 -out PushCert.pem
Strip the passphrase
openssl rsa -in PushCert.pem -out PushKeyNoPass.pem
Open PushCert.pem in a text editor
Replace the encrypted "RSA Private Key" section with contents of PushKeyNoPass.pem
Save it out
The .mobileconfig file contains MDM payload:
With the server cert identify.p12
Push service: development mode
Topic: com.apple.mgmt.External.e8154c51-4788-44bc-8c23-a2669####f9c
After all, the device can be enrolled by https properly, the server could receive Device Token, Push Magic, Unlock Token from device. But when server sends MDM push message: {"mdm" : "PushMagic String>"}, device doesn't receive it. The IPCU device log displays:
Jun 13 16:26:13 unknown MobileSafari[374] <Warning>: webFrameLoader
Jun 13 16:26:16 unknown MobileSafari[374] <Warning>: webFrameLoader
Jun 13 16:26:16 unknown profiled[1394] <Notice>: (Note ) MC: Profile ā-c-o-m-.-c-i-t-e-c-h-.-m-d-m-.-p-r-o-f-i-l-eā -q-u-e-u-e-d -f-o-r -i-n-s-t-a-l-l-a-t-i-o-n-.
Jun 13 16:26:18 unknown profiled[1394] <Notice>: (Note ) MC: Checking for MDM installation...
Jun 13 16:26:18 unknown profiled[1394] <Notice>: (Note ) MC: ...finished checking for MDM installation.
Jun 13 16:26:18 unknown profiled[1394] <Notice>: (Note ) MC: Beginning profile installation...
Jun 13 16:26:20 unknown keybagd[1403] <Notice>: MS:Notice: Installing: (null) [keybagd] (690.10)
Jun 13 16:26:22 unknown profiled[1394] <Notice>: (Note ) profiled: Device unlock notification received
Jun 13 16:26:22 unknown kernel[0] <Debug>: AppleKeyStore:Sending lock change
Jun 13 16:26:22 unknown profiled[1394] <Notice>: (Note ) MC: Profile ā-c-o-m-.-c-i-t-e-c-h-.-m-d-m-.-p-r-o-f-i-l-eā -i-n-s-t-a-l-l-e-d-.
Jun 13 16:26:22 unknown mc_mobile_tunnel[1409] <Notice>: (Note ) MC: mc_mobile_tunnel starting.
Jun 13 16:26:23 unknown mc_mobile_tunnel[1409] <Notice>: (Note ) MC: mc_mobile_tunnel shutting down.
Jun 13 16:26:23 unknown mdmd[1405] <Notice>: MS:Notice: Installing: com.apple.managedconfiguration.mdmd [mdmd] (690.10)
Jun 13 16:26:24 unknown mdmd[1405] <Notice>: (Note ) MDM: mdmd starting...
Jun 13 16:26:24 unknown mdmd[1405] <Notice>: (Note ) MDM: Looking for managed app states to clean up
Jun 13 16:26:24 unknown apsd[95] <Warning>: <APSConnectionServer: 0xd622270>: connection set enabled topics {(
"com.apple.mgmt.External.e8154c51-4788-44bc-8c23-a26695####9c"
)}
Jun 13 16:26:24 unknown apsd[95] <Warning>: <APSCourier: 0x11dcb0>: Sending filter message for enabled hashes {
<10f79d78 c6984a13 f9fc677a 4556fc35 73249ead> = "com.apple.mgmt.External.e8154c51-4788-44bc-8c23-a26695####9c";
<141b878f 22242638 a132b5ba 96284394 eb258b67> = "com.citech.mdm.pushtest";
} and ignored hashes {}
Jun 13 16:26:24 unknown com.apple.launchd[1] <Warning>: (com.apple.managedconfiguration.mdmd) Check-in of Mach service failed. Already active: com.apple.managedconfiguration.mdmdpush-dev
Jun 13 16:26:24 unknown mdmd[1405] <Warning>: Unable to bootstrap_check_in() to namedDelegatePort 'com.apple.managedconfiguration.mdmdpush-dev'. APS connections will not persist past process lifetime.
Jun 13 16:26:24 unknown apsd[95] <Warning>: <APSConnectionServer: 0xd61b820>: Initializing connection server with environmentName 'development' and connectionPortName '(null)'
Jun 13 16:26:24 unknown com.apple.launchd[1] <Warning>: (com.apple.managedconfiguration.mdmd) Check-in of Mach service failed. Already active: com.apple.managedconfiguration.mdmdpush-prod
Jun 13 16:26:24 unknown mdmd[1405] <Warning>: Unable to bootstrap_check_in() to namedDelegatePort 'com.apple.managedconfiguration.mdmdpush-prod'. APS connections will not persist past process lifetime.
Jun 13 16:26:24 unknown apsd[95] <Warning>: <APSConnectionServer: 0x121fa0>: Initializing connection server with environmentName 'production' and connectionPortName '(null)'
Jun 13 16:26:24 unknown apsd[95] <Warning>: <APSConnectionServer: 0xd61b820>: connection set enabled topics {(
"com.apple.mgmt.External.e8154c51-4788-44bc-8c23-a26695####9c"
)}
Jun 13 16:26:24 unknown mdmd[1405] <Notice>: (Note ) MDM: Network reachability has changed.
Jun 13 16:26:24 unknown mdmd[1405] <Notice>: (Note ) MDM: Network reachability has changed.
Jun 13 16:26:24 unknown mdmd[1405] <Notice>: (Note ) MDM: Telling MDM Check-In Server about new device token.
Jun 13 16:26:24 unknown apsd[95] <Warning>: <APSConnectionServer: 0xd62a150>: Initializing connection server with environmentName 'development' and connectionPortName '(null)'
Jun 13 16:26:24 unknown apsd[95] <Warning>: <APSCourier: 0x11dcb0>: Removing connection server <APSConnectionServer: 0xd62a150>
Jun 13 16:26:24 unknown apsd[95] <Warning>: Interface manager: WWAN radio power level notification; DCH status changed to active
Jun 13 16:26:24 unknown apsd[95] <Warning>: Calculated minimum fire date [2013-06-13 16:29:31 +0800] (54%) with fire date [2013-06-13 16:36:26 +0800], start date [2013-06-13 16:21:24 +0800], minimum early fire proportion 0, power state detection supported: yes, in high power state: yes
Jun 13 16:26:24 unknown apsd[95] <Warning>: Calculated minimum fire date [2013-06-13 16:34:23 +0800] (54%) with fire date [2013-06-13 16:42:49 +0800], start date [2013-06-13 16:24:28 +0800], minimum early fire proportion 0, power state detection supported: yes, in high power state: yes
Jun 13 16:26:25 unknown mdmd[1405] <Notice>: (Note ) MDM: Transaction completed. Status: 200
Jun 13 16:26:25 unknown mdmd[1405] <Notice>: (Note ) MDM: Telling MDM Check-In Server about new device token.
Jun 13 16:26:25 unknown apsd[95] <Warning>: <APSConnectionServer: 0xd624a20>: Initializing connection server with environmentName 'development' and connectionPortName '(null)'
Jun 13 16:26:25 unknown apsd[95] <Warning>: <APSCourier: 0x11dcb0>: Removing connection server <APSConnectionServer: 0xd624a20>
Jun 13 16:26:25 unknown mdmd[1405] <Notice>: (Note ) MDM: Transaction completed. Status: 200
Jun 13 16:26:25 unknown mdmd[1405] <Notice>: (Note ) MDM: Telling MDM Check-In Server about new device token.
Jun 13 16:26:25 unknown apsd[95] <Warning>: <APSConnectionServer: 0xd624a20>: Initializing connection server with environmentName 'development' and connectionPortName '(null)'
Jun 13 16:26:25 unknown apsd[95] <Warning>: <APSCourier: 0x11dcb0>: Removing connection server <APSConnectionServer: 0xd624a20>
Jun 13 16:26:25 unknown mdmd[1405] <Notice>: (Note ) MDM: Transaction completed. Status: 200
Jun 13 16:26:27 unknown mdmd[1405] <Notice>: (Note ) MDM: mdmd stopping...
Jun 13 16:26:27 unknown apsd[95] <Warning>: <APSCourier: 0x11dcb0>: Removing connection server <APSConnectionServer: 0xd61b820>
Jun 13 16:26:27 unknown apsd[95] <Warning>: <APSCourier: 0x119eb0>: Removing connection server <APSConnectionServer: 0x121fa0>
Jun 13 16:26:29 unknown apsd[95] <Warning>: Canceling system wake for [2013-06-13 16:42:34 +0800]
Jun 13 16:26:29 unknown apsd[95] <Warning>: Resuming push keep alive timer in normal mode with action PCActionMaintainPushKeepAliveInterval
Changed .mobileconfig push service to Production mode, still couldn't receive. I use github.com/notnoop/java-apns to simulate MDM push, nothing happened. I don't think push message or .mobileconfig file has mistakes, maybe there's something wrong about the cert file.
If somebody could offer some help or hint, it would be a great kindness. I've spent several days on it... Thanks.
My app has some kind of Zombie problem. (Not an NSZombie problem. Like, a coming-back-from-the-dead problem.)
I first noticed that after a debugging session, when I would go for a run the music on my iPhone would pause every ~7 minutes, and when I'd unlock the device the app name would be flashing red in the status bar as though it had just crashed. Sometimes there would even be phantom sound from the app, like it was still running in the background somehow.
Manually quit the app, continue. Still get the intermittent audio artifacts even though the app no longer appears in my list of running apps.
When I plug back in, this is in the console for each time the app zombified and restarted itself. It looks just like a normal launch of the app! What the? What could be triggering my app to restart itself?
Console:
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: cocos2d: cocos2d v1.1.0-beta2b
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: cocos2d: Using Director Type:CCDirectorDisplayLink
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: cocos2d: OS version: 5.1 (0x05010000)
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: cocos2d: GL_VENDOR: Imagination Technologies
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: cocos2d: GL_RENDERER: PowerVR SGX 535
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: cocos2d: GL_VERSION: OpenGL ES-CM 1.1 IMGSGX535-63.24
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: cocos2d: GL_MAX_TEXTURE_SIZE: 2048
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16
// etc //
Apr 26 12:10:01 unknown kernel[0] <Debug>: launchd[2658] Builtin profile: container (sandbox)
Apr 26 12:10:01 unknown kernel[0] <Debug>: launchd[2658] Container: /private/var/mobile/Applications/FFEB0A26-06D1-4C46-8AE5-C60582D09A1D [69] (sandbox)
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: Audio session details
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: Audio Input Available? YES
Apr 26 12:10:01 unknown mediaserverd[32] <Warning>: 12:10:01.641 <SystemSoundServer> WARNING translating HAL error: 561214578
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: Max Possible Inputs 15151420
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: Outputs 2
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: Device sample rate 44100.000000
Apr 26 12:10:01 unknown Breakout[2658] <Warning>: Hardware buffer size 0.023220
// etc //
Apr 26 12:10:33 unknown SpringBoard[52] <Notice>: Posting 'com.apple.iokit.hid.displayStatus' notifyState=1
Apr 26 12:10:33 unknown UserEventAgent[12] <Warning>: DEBUG: Changing screen blanked state: 0
Apr 26 12:10:33 unknown SpringBoard[52] <Notice>: MultitouchHID: detection mode: 255->0 (deferring until bootloaded)
Apr 26 12:10:33 unknown SpringBoard[52] <Notice>: MultitouchHID: device bootloaded
Apr 26 12:10:33 unknown SpringBoard[52] <Notice>: MultitouchHID: detection mode: 0->0
Apr 26 12:10:34 unknown kernel[0] <Debug>: set_crc_notification_state 0
Apr 26 12:10:34 unknown ReportCrash[2659] <Notice>: Formulating crash report for process Breakout[2658]
>
Apr 26 12:10:34 unknown SpringBoard[52] <Warning>: pid_suspend failed for [2658]: Unknown error: -1, Unknown error: -1
Apr 26 12:10:34 unknown SpringBoard[52] <Warning>: Could not set priority of [2658] to 4096, priority: No such process
Apr 26 12:10:34 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.charliewilliams.Breakout[0xd5ad]) Job appears to have crashed: Trace/BPT trap: 5
Apr 26 12:10:34 unknown SpringBoard[52] <Warning>: Application 'Breakout' exited abnormally with signal 5: Trace/BPT trap: 5
Apr 26 12:10:35 unknown ReportCrash[2659] <Error>: libMobileGestalt computeUniqueDeviceID: total time for bb to return imei: 0
Apr 26 12:10:35 unknown ReportCrash[2659] <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/Breakout_2012-04-26-121033_Tortuga-Gigante.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0
Explanation of the solution: It turned out to be simple - 1. I was shutting down my audio session in dealloc but not in applicationDidEnterBackground. And since I'm using kaudiosessioncategory_playandrecord that seems to tell iOS to restart the app if it crashes in the background.
Now, why is it crashing in the background? ...well, that's my next task.
The app may have a background voip flag set. If it does, the OS will restart the app if it exits abnormally (or when the device restarts).
what audio framework are you using? the iPod app, GarageBand and other audio apps present red flashing in the title bar when audio processing continues after exiting the app. This wouldn't happen with Cocos Denshion I don't think, so you must be using an Apple framework for your audio? The answer likely lies with how it is configured. Apple gives some of its own audio frameworks permission to keep running when in the background so you can have customized music playing, like apps for radio stations, etc.
We will probably need code snippets also as the logs don't tell us what code is executed