【发布时间】:2020-12-27 16:21:45
【问题描述】:
我正在使用Buck 将 iOS 14 小部件扩展集成到现有项目中。但是在通过 xcode 构建整个项目后,xcode 会通过以下错误消息提醒我。
Details
SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget '***.***.***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (***.***.***)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***.***.***)}." UserInfo={NSLocalizedDescription=Failed to show Widget '***.***.***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (***.***.***)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***.***.***)}., NSUnderlyingError=0x7fd129f04470 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (***.***.***)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***.***.***)}}}
Domain: DTXMessage
Code: 1
--
System Information
macOS Version 10.15.6 (Build 19G2021)
Xcode 12.0 (17210.1)
我在 xcode 的运行日志中看到了另一个更具体的错误消息:
***[84708:4569018] [default] Failed to find the 'main()' function in the main binary.
在谷歌搜索上述错误后,我认为this thread 指出了小部件扩展启动失败的根本原因。
所以我在笔记本电脑上搜索了 buck 脚本,并删除了 buck 脚本中的所有 '-e _NSExtensionMain' 链接器标志。
然后我重新运行 xcode 构建主应用程序和小部件扩展,但我仍然在 xcode 打印的链接命令选项中找到链接标志 '-e _NSExtensionMain'。
我相信我在 buck 脚本中删除那些链接标志是可行的,因为在删除之前,链接命令选项中有两个连续的 '-e _NSExtensionMain',在删除之后,我可以只看到一个 '-e _NSExtensionMain'。
但是不知道为什么xcode会为我们插入'-e _NSExtensionMain',以及Build Settings或者xcconfigs或者buck文件中的哪个标志会指示xcode插入'-e _NSExtensionMain' 为我们服务。
有人知道根本原因吗?提前致谢。
【问题讨论】: