I have experienced a strange behavior on a demo app i've done.
I'm learning how to develop apps with cordova, i developed a really simple demo app and i installed it with "RUN" of the xcode, in my iPhone 5S with iOS 9.3.
At first the app works really well but after a few days the app starts closing/crashing after the splashscreen.
The app stays in background but when i try to bring it up it closes/crashes again.
-- UPDATE --
After using Configurator for logging i got this :
========== 15/07/2016, 15:31:57 ==========
Jul 15 15:32:00 iPhone-de-Luis SpringBoard[54] : SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Jul 15 15:32:00 iPhone-de-Luis SpringBoard[54] : SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Jul 15 15:32:00 iPhone-de-Luis securityd[93] : secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Jul 15 15:32:00 iPhone-de-Luis securityd[93] : secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Jul 15 15:32:00 iPhone-de-Luis amfid[2207] : SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Jul 15 15:32:00 iPhone-de-Luis amfid[2207] : MIS: entitlement 'application-identifier' has value not permitted by provisioning profile 'iOS Team Provisioning Profile: io.ionic.luis.conference'
Jul 15 15:32:00 iPhone-de-Luis amfid[2207] : /private/var/containers/Bundle/Application/EE241426-5F1E-43B1-911F-C1C292F57F9D/RederiaCatalog.app/RederiaCatalog not valid: 0xe8008016: The executable was signed with invalid entitlements.
Jul 15 15:32:00 iPhone-de-Luis com.apple.xpc.launchd[1] (UIKitApplication:com.project.rederia[0xfc77][2872]) : Service exited due to signal: Killed: 9
Jul 15 15:32:00 iPhone-de-Luis assertiond[63] : Unable to obtain a task name port right for pid 2872: (os/kern) failure (5)
Jul 15 15:32:00 iPhone-de-Luis SpringBoard[54] : Unable to register for exec notifications: No such process
Jul 15 15:32:00 iPhone-de-Luis SpringBoard[54] : Unable to obtain a task name port right for pid 2872: (os/kern) failure (5)
Jul 15 15:32:00 iPhone-de-Luis SpringBoard[54] : Unable to obtain a task name port right for
Jul 15 15:32:00 iPhone-de-Luis SpringBoard[54] : Application 'UIKitApplication:com.project.rederia[0xfc77]' exited abnormally via signal.
Jul 15 15:32:01 iPhone-de-Luis SpringBoard[54] : Application '(null)' exited for an unknown reason.
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 am installing the .mobileconfig using the safari.
But, sometimes when I arouse the safari, it will navigation to the install the mobileconfig page.
The screen will freeze on the white screen, that does not show the install button on the right top.
like below:
Have anyone had encounter the same problem?
My code to call the safari is using below code:
NSURL *url = [NSURL URLWithString:#"http://127.0.0.1:777/myconfig.mobileconfig"];
[[UIApplication sharedApplication]openURL:url];
I had copy the error command log like below:
Jan 7 21:53:25 James-iphone nsurlsessiond[109] <Error>: Task 2 for client <CFString 0x154e5e4f0 [0x1a0e33b68]>{contents = "com.apple.mobileassetd"} completed with error - code: -999
Jan 7 21:53:25 James-iphone Preferences[464] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Jan 7 21:53:25 James-iphone Preferences[464] <Notice>: MIS: Using empty blacklist.
Jan 7 21:53:25 James-iphone syncdefaultsd[519] <Notice>: (Note ) marked "com.me.keyvalueservice" topic as "opportunistic" on <APSConnection: 0x136515d10>
Jan 7 21:53:26 James-iphone Preferences[464] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Jan 7 21:53:26 James-iphone Preferences[464] <Notice>: MIS: Using empty blacklist.
Jan 7 21:53:26 James-iphone Preferences[464] <Notice>: (Note ) MC: Applying iPhone defaults
Jan 7 21:53:26 James-iphone Preferences[464] <Warning>: BTM: attaching to BTServer
Jan 7 21:53:26 James-iphone Preferences[464] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Jan 7 21:53:26 James-iphone Preferences[464] <Notice>: MIS: Using empty blacklist.
Jan 7 21:53:27 James-iphone syncdefaultsd[519] <Notice>: (Note ) marked "com.me.keyvalueservice" topic as "enabled" on <APSConnection: 0x136515d10>
Jan 7 21:53:27 James-iphone MobileSafari[514] <Error>: KeychainGetICDPStatus: keychain: -25300
Jan 7 21:53:27 James-iphone MobileSafari[514] <Error>: KeychainGetICDPStatus: status: off
Jan 7 21:53:27 James-iphone MobileSafari[514] <Error>: KeychainGetICDPStatus: keychain: -25300
Jan 7 21:53:27 James-iphone MobileSafari[514] <Error>: KeychainGetICDPStatus: status: off
Jan 7 21:53:27 James-iphone MobileSafari[514] <Error>: KeychainGetICDPStatus: keychain: -25300
Jan 7 21:53:27 James-iphone MobileSafari[514] <Error>: KeychainGetICDPStatus: status: off
Jan 7 21:53:28 James-iphone Preferences[464] <Warning>: *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.30.14/UITableView.m:1720
Jan 7 21:53:28 James-iphone Preferences[464] <Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 5. The number of rows contained in an existing section after the update (7) must be equal to the number of rows contained in that section before the update (4), plus or minus the number of rows inserted or deleted from that section (2 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
*** First throw call stack:
(0x183805900 0x182e73f80 0x1838057d0 0x18417899c 0x1886f004c 0x1941301c4 0x194136d64 0x183259630 0x1832595f0 0x18325ecf8 0x1837bcbb0 0x1837baa18 0x1836e9680 0x184bf8088 0x188560d90 0x1000b7718 0x18328a8b8)
Jan 7 21:53:28 James-iphone SpringBoard[54] <Warning>: HW kbd: Failed to set (null) as keyboard focus
Jan 7 21:53:28 James-iphone com.apple.xpc.launchd[1] (UIKitApplication:com.apple.Preferences[0xfe24][464]) <Notice>: Service exited due to signal: Abort trap: 6
Jan 7 21:53:28 James-iphone SpringBoard[54] <Warning>: Application 'UIKitApplication:com.apple.Preferences[0xfe24]' crashed.
Jan 7 21:53:28 James-iphone UserEventAgent[23] <Warning>: 2463897065357: id=com.apple.Preferences pid=464, state=0
Jan 7 21:53:28 James-iphone MobileGestaltHelper[88] <Error>: libMobileGestalt MobileGestalt.c:276: server_access_check denied access to question UniqueDeviceID for pid 519
Jan 7 21:53:28 James-iphone syncdefaultsd[519] <Error>: libMobileGestalt MobileGestaltSupport.m:151: pid 519 (syncdefaultsd) does not have sandbox access for re6Zb+zwFKJNlkQTUeT+/w and IS NOT appropriately entitled
Jan 7 21:53:28 James-iphone syncdefaultsd[519] <Error>: libMobileGestalt MobileGestalt.c:537: no access to UniqueDeviceID (see <rdar://problem/11744455>)
Jan 7 21:53:28 James-iphone diagnosticd[82] <Error>: unable to find offset 0x8327f9a4 in shared cache for arch 'arm64'
Jan 7 21:53:28 James-iphone ReportCrash[520] <Notice>: platform_thread_get_unique_id matched 240727
Jan 7 21:53:28 James-iphone ReportCrash[520] <Notice>: Formulating report for corpse[464] Preferences
Jan 7 21:53:28 James-iphone ReportCrash[520] <Warning>: saved type '109_Preferences' report (21 of max 25) as /var/mobile/Library/Logs/CrashReporter/Preferences_2016-01-07-215328_James-iphone.ips
Jan 7 21:53:29 James-iphone pkd[154] <Warning>: assigning plug-in app.cyan.timy.dayext(2.2) to plugin sandbox
Jan 7 21:53:29 James-iphone pkd[154] <Warning>: enabling pid=54 for plug-in app.cyan.timy.dayext(2.2) B9580AEF-CE50-4DD3-A98C-9B5AF2933220 /private/var/mobile/Containers/Bundle/Application/D753EF69-C9C2-4C71-9755-79F8553787A9/HourDay.app/PlugIns/DayExt.appex
Jan 7 21:53:30 James-iphone SpringBoard[54] <Warning>: plugin app.cyan.timy.dayext invalidated
Jan 7 21:53:31 James-iphone SpringBoard[54] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
Jan 7 21:53:31 James-iphone SpringBoard[54] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
Jan 7 21:53:31 James-iphone com.apple.WebKit.WebContent[518] <Error>: CoreAnimation: failed to allocate IOSurface
Jan 7 21:53:36 James-iphone mediaserverd[25] <Notice>: '' (pid = 516) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Jan 7 21:53:36 James-iphone com.apple.xpc.launchd[1] (com.apple.WebKit.WebContent.A90CE0BD-CDCB-43AB-9311-B0D990645C4E[516]) <Warning>: Service exited with abnormal code: 1
Jan 7 21:53:36 James-iphone mediaserverd[25] <Notice>: '' (pid = 516) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Jan 7 21:53:36 James-iphone mediaserverd[25] <Notice>: 'FigPlayer - 31' (pid = 31) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Jan 7 21:53:36 James-iphone SpringBoard[54] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
Maybe can give you some hint.
Are you installing OVER other profiles or along with others? I've replaced mine a few times now and iOS 9.1 doesn't like it for me on the iPhone 6+.
The only (want most painless) way I've found is to remove the old profiles before I install new ones via Xcode
On Xcode:
1) Click on the "Window" menu
2) Click on "Devices"
3) Wait for your Device (devices) to load .. Oh make sure they're plugged in! hah
4) Right click on the device you need to change profiles on
5) Click on "Show provisioning profiles"
In there you can add and delete profiles safely :)
edit
The other options is what's called OTAC (over the air configuration)... It's exactly what happens when your mobile phone provider sends you new APN settings and it asks you to install the settings "out of the blue"...
The docs are here:
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/iPhoneOTAConfiguration/Introduction/Introduction.html
The only issue you'll have is that this isn't something you can do on the simulator so you'd better create "dummy profiles" to avoid replacing your development or production ones.
Another note, I did find this post on here: Installing a configuration profile on iPhone - programmatically
first of all, I would like to thank you for creating this library. I have embedded it in my project (as written in the README file) by dragging it into the project, embedding it in the binaries and so on. Target iOS version is 8.0.
Everything worked great for dev version of the app, but as soon as I built the inhouse version, app crashes after initial welcome screen shows. Logs for the crash are as following:
Oct 20 15:54:15 iPhone SpringBoard[54] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Oct 20 15:54:15 iPhone SpringBoard[54] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Oct 20 15:54:15 iPhone kernel[0] <Notice>: xpcproxy[700] Container: /private/var/mobile/Containers/Data/Application/6D451583-EE0E-4F0A-9CA9-2E33F83D6138 (sandbox)
Oct 20 15:54:15 iPhone kernel[0] <Notice>: AMFI: energy_challenge(pid 700) - [deny-mmap] mapped executable file has no team identifier in its signature: /private/var/mobile/Containers/Bundle/Application/84AEA7F2-4987-4119-B3CC-A4EAFC9989DC/energy_challenge.app/Frameworks/Charts.framework/Charts
Oct 20 15:54:15 iPhone com.apple.xpc.launchd[1] (UIKitApplication:com.edge5.nativeMenuEnergieInhouse[0x1f2e][700]) <Notice>: Service exited due to signal: Trace/BPT trap: 5
Oct 20 15:54:15 iPhone assertiond[63] <Warning>: Unable to obtain a task name port right for pid 700: (os/kern) failure (5)
Oct 20 15:54:15 iPhone SpringBoard[54] <Warning>: Unable to register for exec notifications: No such process
Oct 20 15:54:15 iPhone SpringBoard[54] <Warning>: Unable to obtain a task name port right for pid 700: (os/kern) failure (5)
Oct 20 15:54:15 iPhone SpringBoard[54] <Warning>: Unable to obtain a task name port right for <FBApplicationProcess: 0x13226dc00; com.edge5.nativeMenuEnergieInhouse; pid: 700>
Oct 20 15:54:15 iPhone SpringBoard[54] <Warning>: Application 'UIKitApplication:com.edge5.nativeMenuEnergieInhouse[0x1f2e]' crashed.
Oct 20 15:54:15 iPhone SpringBoard[54] <Warning>: Application '(null)' exited for an unknown reason.
Oct 20 15:54:15 iPhone ReportCrash[701] <Notice>: Formulating report for corpse[700] energy_challenge
Oct 20 15:54:15 iPhone ReportCrash[701] <Warning>: report not saved because the limit of 25 for 109_energy_challenge logs has been reached.
Oct 20 15:54:15 iPhone ReportCrash[701] <Error>: Notice: This report is abbreviated for syslog inclusion because it could not be saved to disk.
Symbolication may be possible by manually cleaning up and including the Binary Image section of a full report from this same device -- good luck!
Oct 20 15:54:15 iPhone ReportCrash[701] <Error>: Process: energy_challenge [700]
Path: /private/var/mobile/Containers/Bundle/Application/84AEA7F2-4987-4119-B3CC-A4EAFC9989DC/energy_challenge.app/energy_challenge
OS Version: iOS 9.0.2 (13A452)
Oct 20 15:54:15 iPhone ReportCrash[701] <Error>: Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000120095088
Triggered by Thread: 0
Oct 20 15:54:15 iPhone ReportCrash[701] <Error>: Dyld Error Message:
Dyld Message: Library not loaded: #rpath/Charts.framework/Charts
Referenced from: /var/mobile/Containers/Bundle/Application/84AEA7F2-4987-4119-B3CC-A4EAFC9989DC/energy_challenge.app/energy_challenge
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/84AEA7F2-4987-4119-B3CC-A4EAFC9989DC/energy_challenge.app/Frameworks/Charts.framework/Charts: mmap() errno=1 validating first page of '/private/var/mobile/Containers/Bundle/Application/84AEA7F2-4987-4119-B3CC-A4EAFC9989DC/energy_challenge.app/Frameworks/Charts.framework/Charts'
Dyld Version: 369.12
Oct 20 15:54:16 iPhone wifid[39] <Error>: WiFi:[467042056.241745]: Enable WoW requested by "apsd"
Oct 20 15:54:16 iPhone wifid[39] <Error>: WiFi:[467042056.243839]: Unable to dispatch WowStateChanged message to client dataaccessd (268435460)
Oct 20 15:54:16 iPhone wifid[39] <Error>: WiFi:[467042056.244041]: Unable to dispatch WowStateChanged message to client MobileMail (268435460)
Oct 20 15:54:16 iPhone wifid[39] <Error>: WiFi:[467042056.244185]: Unable to dispatch WowStateChanged message to client softwareupdatese (268435460)
Oct 20 15:54:16 iPhone wifid[39] <Error>: WiFi:[467042056.244422]: Unable to dispatch WowStateChanged message to client dataaccessd (268435460)
Oct 20 15:54:16 iPhone wifid[39] <Error>: WiFi:[467042056.244678]: Unable to dispatch WowStateChanged message to client assistantd (268435460)
Oct 20 15:54:16 iPhone wifid[39] <Error>: WiFi:[467042056.245010]: Unable to dispatch WowStateChanged message to client itunesstored (268435460)
The problem occurs here:
[deny-mmap] mapped executable file has no team identifier in its signature: /private/var/mobile/Containers/Bundle/Application/84AEA7F2-4987-4119-B3CC-A4EAFC9989DC/energy_challenge.app/Frameworks/Charts.framework/Charts
I tried creating new certificate, new inhouse build, basically went through all the stackoverflow questions regarding this or similar issue (eg. https://www.airsignapp.com/ios-apps-using-swift-crash-when-signed-with-inhouse-certificate/) without any success. Is it possible that maybe you need to change something certificate-related on your side?
Thank you very much for any answer
I came across this post when I was searching for "[deny-mmap] mapped executable file has no team identifier in its signature" on Google.
It turned out that the old Apple WWDR Cert expired on 14 Feb 2016. If your OSX still has that expired cert in Keychain Access, your Distribution Certificate would be regarded as invalid. (A red line showing "This certificate has an invalid issuer") You could forcefully "trust" that cert in Keychain Access, but the side effect is that the signed binary would NOT have TeamIdentifier in its signature:
$ codesign -d -vv MyApp.app
Executable=/Users/admin/MyApp.app/MyApp
Identifier=info.eddywong.MyApp
Format=bundle with Mach-O universal (armv7 arm64)
CodeDirectory v=20100 size=1920 flags=0x0(none) hashes=87+5 location=embedded
Signature size=4389
Authority=iPhone Distribution: Eddy Wong Limited (KG7UETNRCJ)
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=15 Mar 2016 23:59:38
Info.plist entries=33
TeamIdentifier=not set
Sealed Resources version=2 rules=12 files=108
So I had to follow the solution posted in https://stackoverflow.com/a/35400712 - to remove the old, expired WWDR certificate in "System" keychain.
Then, I cleaned and re-archive, then export IPA. This time it works!
The reason why "Everything worked great for dev version of the app" is that dev version of the app is signed by your own developer cert, not your organization's distribution cert. I can't figure out why developer cert is not affected by WWDR expiry, though. But I could verify that the dev signed binary does have the TeamIdentifier set, while the dist signed binary doesn't.
This has been previously working for iOS 7 and 8 devices but now the enrollment fails for new iOS 9 devices. This is what I see in the device logs.
Oct 26 18:00:34 iPhone profiled[412] <Notice>: (Note ) MC: Enrolling in OTA Profile service...
Oct 26 18:00:35 iPhone profiled[412] <Error>: SecTrustEvaluate [leaf AnchorTrusted]
Oct 26 18:00:38 iPhone securityd[83] <Error>: securityd_xpc_dictionary_handler profiled[412] add Error Domain=NSOSStatusErrorDomain Code=-25299 "duplicate item O,cert,159EFDE0,L,dku,com.apple.certificates,0,ctyp,cenc,labl,subj,issr,slnr,pkhh,v_Data,20151026123038.608026Z,7C914284" UserInfo={NSDescription=duplicate item O,cert,159EFDE0,L,dku,com.apple.certificates,0,ctyp,cenc,labl,subj,issr,slnr,pkhh,v_Data,20151026123038.608026Z,7C914284}
Oct 26 18:00:38 iPhone profiled[412] <Error>: SecOSStatusWith error:[-25299] Error Domain=NSOSStatusErrorDomain Code=-25299 "duplicate item O,cert,159EFDE0,L,dku,com.apple.certificates,0,ctyp,cenc,labl,subj,issr,slnr,pkhh,v_Data,20151026123038.608026Z,7C914284" UserInfo={NSDescription=duplicate item O,cert,159EFDE0,L,dku,com.apple.certificates,0,ctyp,cenc,labl,subj,issr,slnr,pkhh,v_Data,20151026123038.608026Z,7C914284}
Oct 26 18:00:38 iPhone profiled[412] <Error>: SecTrustEvaluate [leaf AnchorTrusted]
Oct 26 18:00:38 iPhone profiled[412] <Notice>: (Note ) MC: Attempting to retrieve issued certificate...
Oct 26 18:00:39 iPhone securityd[83] <Error>: SecDbRecordChange db <SecDbConnection rw open> changed outside txn
Oct 26 18:00:39 iPhone profiled[412] <Notice>: (Note ) MC: Issued certificate received.
Oct 26 18:00:39 iPhone Preferences[406] <Notice>: (Error) MC: Install profile data, interactive error. Error: NSError:
Desc : Couldn’t communicate with a helper application.
Sugg : Try your operation again. If that fails, quit and relaunch the application and try again.
Domain : NSCocoaErrorDomain
Code : 4097
Extra info:
{
NSDebugDescription = "connection to service named com.apple.managedconfiguration.profiled";
}
Oct 26 18:00:39 iPhone com.apple.xpc.launchd[1] (com.apple.managedconfiguration.profiled[412]) <Notice>: Service exited due to signal: Trace/BPT trap: 5
Oct 26 18:00:40 iPhone ReportCrash[423] <Error>: assertion failed: 13A452: libsystem_trace.dylib + 15931 [45DE3123-E22D-320F-9F75-1CCD65A33451]: 0x0
Oct 26 18:00:40 iPhone Unknown[423] <Error>:
Oct 26 18:00:40 iPhone ReportCrash[423] <Warning>: os_activity_diagnostic_for_pid() failed!
Oct 26 18:00:40 iPhone ReportCrash[423] <Notice>: Formulating report for corpse[412] profiled
assertion failed: 13A452: libsystem_trace.dylib + 15931
means that your process "profiled" overran its allocated memory and was killed via the kernel/jetsam. iOS 9 has aggressive memory management and kills processes all over the place and even reboots the device nightly.
Just answering my own question. In order to create the X509 certificate from csr you need to create relative distinguished names (RDNs) and add it to the certificate. Once you get the X500Name from PKCS10CertificationRequest and set it to X509v3CertificateBuilder it throws this error. Rather you have to create separate X500Names and proceed with the certificate generation which solved this issue.