Xcode crashes due to malformed provisioning profile.

After obtaining the entitlement : "com.apple.developer.passkit.pass-presentation-suppression" we had some issue with xcode it started to systematically crash on launch as soon as we install a .mobileprovision file containing the entitlement. The problem would just disappear as soon as we installed the profile without the Entitlement.

for reference the same problem was seen in all xcode version starting from 11.3.1 to 11.5

Here you find the crash report.

Code Block language
Process: Xcode [45441]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 11.5 (16139)
Build Info: IDEFrameworks-16139000000000000~62 (11E608c)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [45441]
User ID: 504
Date/Time: 2020-06-19 10:29:43.099 +0200
OS Version: Mac OS X 10.15.4 (19E287)
Report Version: 12
Anonymous UUID: 2E1D5A4C-786C-32BF-DA92-1BAAC6FED8AA
Time Awake Since Boot: 600000 seconds
System Integrity Protection: enabled
Crashed Thread: 26
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
ProductBuildVersion: 11E608c
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[NSArrayM hasSuffix:]: unrecognized selector sent to instance 0x7fc1a5d47c60
UserInfo: (null)
Open FDs: 77/7168
Hints:
0: Calling block provided by:
0 DVTDispatchAsync (in DVTFoundation)
1 DVTAsyncPerformBlock (in DVTFoundation)
2 131-[IDEProvisionableManager immediatelyEvaluateWithOverrides:deviceRequirement:shouldRepairIfNecessary:isXBS:callbackQueue:callback:]_block_invoke_3 (in IDEFoundation)
3 NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK (in Foundation)
4 -[NSBlockOperation main] (in Foundation)
5 NSOPERATION_IS_INVOKING_MAIN (in Foundation)
6 -[NSOperation start] (in Foundation)
7 NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION (in Foundation)
8 NSOQSchedule_f (in Foundation)
9 _dispatch_block_async_invoke2 (in libdispatch.dylib)
10 _dispatch_client_callout (in libdispatch.dylib)
11 _dispatch_continuation_pop (in libdispatch.dylib)
12 _dispatch_async_redirect_invoke (in libdispatch.dylib)
13 _dispatch_root_queue_drain (in libdispatch.dylib)
14 _dispatch_worker_thread2 (in libdispatch.dylib)
15 _pthread_wqthread (in libsystem_pthread.dylib)
16 start_wqthread (in libsystem_pthread.dylib)
Backtrace:
0 exceptionPreprocess (in CoreFoundation)
1 DVTFailureHintExceptionPreprocessor (in DVTFoundation)
2 objc_exception_throw (in libobjc.A.dylib)
3 -[NSObject(NSObject) retain_OA] (in CoreFoundation)
4 _forwarding_ (in CoreFoundation)
5 _CF_forwarding_prep_0 (in CoreFoundation)
6 -[IDEEntitlementsMerger entitlementsByMergingProfileEntitlements:appEntitlements:bundleIdentifier:appName:profileName:warnings:error:] (in IDEFoundation)
7 -[IDEProvisionableStatusEvaluation mergedEntitlementsWithWarnings:error:] (in IDEFoundation)
8 +[IDEProvisioningCommandInputs inputsFromEvaluation:] (in IDEFoundation)
9 -[IDEProvisionableStatusEvaluation provisioningCommandInputs] (in IDEFoundation)
10 97-[IDEProvisioningManager evaluateProvisioningForProvisionable:overrides:deviceRequirement:isXBS:]_block_invoke_2.374 (in IDEFoundation)
11 131-[IDEProvisionableManager immediatelyEvaluateWithOverrides:deviceRequirement:shouldRepairIfNecessary:isXBS:callbackQueue:callback:]_block_invoke.364 (in IDEFoundation)
12 DVT_CALLING_CLIENT_BLOCK (in DVTFoundation)
13 DVTDispatchAsync_block_invoke (in DVTFoundation)
14 _dispatch_call_block_and_release (in libdispatch.dylib)
15 _dispatch_client_callout (in libdispatch.dylib)
16 _dispatch_lane_serial_drain (in libdispatch.dylib)
17 _dispatch_lane_invoke (in libdispatch.dylib)
18 _dispatch_workloop_worker_thread (in libdispatch.dylib)
19 _pthread_wqthread (in libsystem_pthread.dylib)
20 start_wqthread (in libsystem_pthread.dylib)
abort() called
Application Specific Signatures:
NSInvalidArgumentException


Yeah, it looks like there is a formatting issue in your provisioning profile:

ProductBuildVersion: 11E608c
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[NSArrayM hasSuffix:]: unrecognized selector sent to instance 0x7fc1a5d47c60

Comparing your provisioning profile against you entitlements file in your app, what do they both look like?

To output the contents of your provisioning profile:
$ security cms -D -i provisionprofile

If you see a strange formatting issue in your provisioning profile you can probably stop there and open a DTS incident to have this further investigated.

If your profile looks fine then compare it to the source output of your entitlements file in Xcode project and see if they match.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
@Matt Eaton

Thanks for the reply, i compared to mobileprovision files one with the entitlement the other without, and weirdly enough i don't see any major issues . The only difference i was able to tell was the entitlement that was added in the right section i might add.
Thanks for the follow up. Could you paste output from your entitlements file in your app and from the entitlements in your provisioning profile here? Please sanitize sensitive bundle identifier information, but I just want to compare the output of the two and see what the format looks like in the provisioning profile.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
@Matt Eaton

Thanks for the reply i will do so by the end of the day.

Andolsi Amine
ahmedamine.andolsi@orange.com

Here is the first without the entitlement

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppIDName</key>
<string>****</string>
<key>ApplicationIdentifierPrefix</key>
<array>
<string>****</string>
</array>
<key>CreationDate</key>
<date>2020-06-11T11:56:06Z</date>
<key>Platform</key>
<array>
<string>iOS</string>
</array>
<key>IsXcodeManaged</key>
<false/>
<key>DeveloperCertificates</key>
<array>
<data>Datatatatatatatatatatataatatat</data>
</array>
<key>Entitlements</key>
<dict>
<key>beta-reports-active</key>
<true/>
<key>application-identifier</key>
<string>##########</string>
<key>keychain-access-groups</key>
<array>
<string>########.*</string>
</array>
<key>get-task-allow</key>
<false/>
<key>com.apple.developer.team-identifier</key>
<string>#############@</string>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.###########</string>
</array>
</dict>
<key>ExpirationDate</key>
<date>2021-06-11T11:45:40Z</date>
<key>Name</key>
<string>Release MyApp no Suppression</string>
<key>TeamIdentifier</key>
<array>
<string>#########</string>
</array>
<key>TeamName</key>
<string>###########</string>
<key>TimeToLive</key>
<integer>364</integer>
<key>UUID</key>
<string>28c0bb00-b1c6-43a5-9759-fee6e2ca9d82</string>
<key>Version</key>
<integer>1</integer>
</dict>
</plist>

And the second profile with suppression

Code Block <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppIDName</key>
<string>########</string>
<key>ApplicationIdentifierPrefix</key>
<array>
<string>########</string>
</array>
<key>CreationDate</key>
<date>2020-07-07T09:21:44Z</date>
<key>Platform</key>
<array>
<string>iOS</string>
</array>
<key>IsXcodeManaged</key>
<false/>
<key>DeveloperCertificates</key>
<array>
<data>datatatadatdatda</data>
</array>
<key>Entitlements</key>
<dict>
<key>beta-reports-active</key>
<true/>
<key>com.apple.developer.passkit.pass-presentation-suppression</key>
<true/>
<key>application-identifier</key>
<array>
<string>###############</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>##########.*</string>
<string>com.apple.token</string>
</array>
<key>get-task-allow</key>
<false/>
<key>com.apple.developer.team-identifier</key>
<string>##############</string>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.##########@</string>
</array>
</dict>
<key>ExpirationDate</key>
<date>2021-06-11T11:45:40Z</date>
<key>Name</key>
<string>Release With Supression</string>
<key>TeamIdentifier</key>
<array>
<string>##########</string>
</array>
<key>TeamName</key>
<string>##########</string>
<key>TimeToLive</key>
<integer>339</integer>
<key>UUID</key>
<string>21457fbb-25cc-4325-9ca4-364863fc96dc</string>
<key>Version</key>
<integer>1</integer>
</dict>
</plist>

We're having the exact same issue over here. Was a resolution reached?
I am having a crash too.
My feeling is that the problem could be when we include the entitlement com.apple.developer.passkit.pass-presentation-suppression in our provisioning profile the value for the key application-identifier is an array with one string, and when we do not include this entitlement the value for the key application-identifier is just the string.
My assumption may also explain the error shows in the previous reply:

ProductBuildVersion: 11E608c
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[NSArrayM hasSuffix:]: unrecognized selector sent to instance 0x7fc1a5d47c60

Here is the part in the provisioning profile that I refer to:

Code Block
...
<key>com.apple.developer.passkit.pass-presentation-suppression</key>
<true/>
<key>application-identifier</key>
<array>
<string>##########.###.########.######</string>
</array>
...


And here is the diff between two provisioning profiles created with and without the entitlement com.apple.developer.passkit.pass-presentation-suppression. The two provisioning profiles were the result of running the command line security cms -D -i Mobileprovision



| => diff with-passkit-entitlement.mobileprovision without-passkit-entitlement.mobileprovision
12c12
< <date>2020-12-24T01:33:51Z</date>


> <date>2020-12-24T00:50:06Z</date>
27,32d26
< <key>com.apple.developer.passkit.pass-presentation-suppression</key>
< <true/>
< <key>application-identifier</key>
< <array>
< <string>##########.###.########.######</string>
< </array>
43c37,40
<

>
> <key>application-identifier</key>
> <string>##########.###.########.######</string>
>
86c83
< <date>2021-12-24T01:33:51Z</date>

> <date>2021-12-24T00:50:06Z</date>
129c126
< <string>######-###-###-###-#########</string>

> <string>######-###-###-###-#########</string>

Xcode crashes due to malformed provisioning profile.
 
 
Q