NEHotspotHelper 导致 Xcode 崩溃
Posted
技术标签:
【中文标题】NEHotspotHelper 导致 Xcode 崩溃【英文标题】:NEHotspotHelper causing Xcode crash 【发布时间】:2020-12-18 10:01:10 【问题描述】:我已获得使用 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 发生此崩溃
我已经尝试了通常的技巧:
清理了构建文件夹 已删除派生数据 已删除 xcuserdata 尝试了一个新的(干净的)项目 在不同的 Mac 上试过我从 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
【问题讨论】:
异常表示在预期字符串的位置传递了一个数组。然后系统调用hasSuffix
,但是因为它有一个数组而不是一个字符串,所以它崩溃了。还有一些similar reports;您可能需要提出开发者支持请求。
【参考方案1】:
因此,在这种情况下,崩溃是由配置文件中授予的权利与权利文件中指定的权利不匹配引起的。 如果您遇到此问题,请首先在 Apple Developer 门户中确保您没有针对您的应用 ID 包含您不再需要的任何权利。
然后生成配置文件,将其下载到您的计算机并使用文本编辑器打开,您将看到一个带有 XML 授权的部分。
在文本编辑器中为您的应用打开您的权利文件(这样您就可以看到 XML)。然后,您可以将配置文件中的 XML 复制到您的权利文件中。
保存权利文件后,您应该能够清理构建文件夹、安装新的配置文件并在 Xcode 中运行应用程序而不会导致 Xcode 崩溃。
【讨论】:
以上是关于NEHotspotHelper 导致 Xcode 崩溃的主要内容,如果未能解决你的问题,请参考以下文章
NEHotspotHelper.register 未收到回调iOS11