Search code examples
iosxcodeprovisioning-profileentitlementsnehotspothelper

NEHotspotHelper causing Xcode crash


I have been granted permission to use NEHotspotHelper and have generated a new provisioning profile with the HotspotHelper entitlement.

I have manually installed the provisioning profile into my project and added the following to my entitlements file:

<dict>
    <key>com.apple.developer.networking.HotspotHelper</key>
    <true/>
</dict>

I have made sure that my device is added to the provisioning profile and when I build to the device (or archive) then Xcode crashes.

This crash has happened with Xcode 12.0.1, Xcode 12.1, Xcode 12.2 and Xcode 12.3

I have tried the usual tricks:

  • Cleaned the build folder
  • Deleted derived data
  • Deleted xcuserdata
  • Tried with a new (clean) project
  • Tried on a different Mac

I get the following crash log from Xcode:

    ProductBuildVersion: 12B45b
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[__NSArrayM hasSuffix:]: unrecognized selector sent to instance 0x7fca6ead8a30
UserInfo: (null)
Open FDs: 156/9472
Hints:
  0: Calling block provided by:

  0   DVTDispatchAsync (in DVTFoundation)
  1   DVTAsyncPerformBlock (in DVTFoundation)
  2   __136-[IDEProvisionableManager immediatelyEvaluateWithOverrides:destinationRequirement: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:teamAccountPairManager:] (in IDEFoundation)
  9   +[IDEProvisioningCommandInputs inputsFromEvaluation:] (in IDEFoundation)
 10   -[IDEProvisionableStatusEvaluation provisioningCommandInputs] (in IDEFoundation)
 11   __102-[IDEProvisioningManager evaluateProvisioningForProvisionable:overrides:destinationRequirement:isXBS:]_block_invoke_2.372 (in IDEFoundation)
 12   __136-[IDEProvisionableManager immediatelyEvaluateWithOverrides:destinationRequirement:shouldRepairIfNecessary:isXBS:callbackQueue:callback:]_block_invoke.366 (in IDEFoundation)
 13   __DVT_CALLING_CLIENT_BLOCK__ (in DVTFoundation)
 14   __DVTDispatchAsync_block_invoke (in DVTFoundation)
 15   _dispatch_call_block_and_release (in libdispatch.dylib)
 16   _dispatch_client_callout (in libdispatch.dylib)
 17   _dispatch_lane_serial_drain (in libdispatch.dylib)
 18   _dispatch_lane_invoke (in libdispatch.dylib)
 19   _dispatch_workloop_worker_thread (in libdispatch.dylib)
 20   _pthread_wqthread (in libsystem_pthread.dylib)
 21   start_wqthread (in libsystem_pthread.dylib)

abort() called

Solution

  • So it turns out in this instance the crash was caused by a mismatch between the entitlements granted in the provisioning profile and those specified in the Entitlements file. If you are having this issue first ensure in the Apple Developer portal that you are not including any entitlements against your app ID that you no longer need.

    Then generate a provisioning profile, download this to your machine and open with a text editor, you will see a section with entitlements in XML.

    Open up your entitlements file for you app in a text editor (so you can see the XML). You can then copy the XML from the provisioning profile into your entitlements file.

    Once you have saved the entitlements file you should be able to clean the build folder, install the new provisioning profile and run the app in Xcode without Xcode crashing.