NEHotspotHelper 导致 Xcode 崩溃

NEHotspotHelper causing Xcode crash

我已获得使用 NEHotspotHelper 的权限,并已生成具有 HotspotHelper 授权的新配置文件。

我已将配置文件手动安装到我的项目中,并将以下内容添加到我的权利文件中:

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

我已确保我的设备已添加到配置文件中,当我构建到设备(或存档)时 Xcode 崩溃。

此崩溃发生在 Xcode 12.0.1、Xcode 12.1、Xcode 12.2 和 Xcode 12.3

我已经尝试了常用的技巧:

我从 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

因此,在这种情况下,崩溃是由配置文件中授予的权利与权利文件中指定的权利不匹配引起的。 如果您遇到此问题,请首先确保在 Apple Developer 门户中没有包含您不再需要的任何针对您的应用程序 ID 的权利。

然后生成配置文件,将其下载到您的计算机并使用文本编辑器打开,您将在 XML 中看到一个包含权利的部分。

在文本编辑器中为您的应用程序打开权利文件(这样您就可以看到 XML)。然后,您可以将配置文件中的 XML 复制到您的权利文件中。

保存授权文件后,您应该能够清理构建文件夹,安装新的配置文件和 运行 Xcode 中的应用程序,而不会 Xcode 崩溃。