当Safari应用程序扩展未出现在Safari首选项中时,如何解决?

时间:2018-12-13 08:32:20

标签: xcode xcode10.1 safari-app-extension

我正在开发Safari应用程序扩展。以前它工作正常。当我在Xcode中运行项目并在Safari中启用允许未签名的扩展时,我可以在 Safari偏好设置->扩展页面中看到我的扩展。

我与团队成员之一合并代码后,突然无法安装扩展程序。

我尝试过:

  • 在Xcode中清洁build文件夹,然后再次运行。但没有运气。
  • 重启Xcode也无济于事。
  • 使用命令pluginkit -mAvvv -p com.apple.Safari.extension检查已安装的Safari扩展列表。我的扩展名不在列表中。

Xcode输出中存在一些错误,但是我无法将它们与我面临的问题联系起来:

objc[49476]: Class AMSupportURLConnectionDelegate is implemented in both /System/Library/PrivateFrameworks/EmbeddedOSInstall.framework/Versions/A/EmbeddedOSInstall (0x7fff9a2aa748) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x108db2600). One of the two will be used. Which one is undefined.
objc[49476]: Class AMSupportURLSession is implemented in both /System/Library/PrivateFrameworks/OSPersonalization.framework/Versions/A/OSPersonalization (0x7fff9b5d49f0) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x108db2650). One of the two will be used. Which one is undefined.
2018-12-13 16:25:46.003099+0800 Safari[49476:1264277] Could not connect action, target class SecurityPreferences does not respond to -toggleJavaScriptCanOpenWindows:
2018-12-13 16:25:46.163130+0800 Safari[49476:1264277] AssertMacros: 0 (value = 0x0),  file: /BuildRoot/Library/Caches/com.apple.xbs/Sources/BiometricKit/BiometricKit-75.71.1/BiometricKit/BiometricKitXPCClient.m, line: 75
2018-12-13 16:25:46.163219+0800 Safari[49476:1264277] AssertMacros: 0 (value = 0x0),  file: /BuildRoot/Library/Caches/com.apple.xbs/Sources/BiometricKit/BiometricKit-75.71.1/BiometricKit/BiometricKitXPCClient.m, line: 396
2018-12-13 16:25:46.163465+0800 Safari[49476:1264277] [Framework-Internal-Legacy] AssertMacros: _xpcClient (value = 0x0),  file: /BuildRoot/Library/Caches/com.apple.xbs/Sources/BiometricKit/BiometricKit-75.71.1/BiometricKit/BiometricKit.m, line: 137
2018-12-13 16:25:47.060959+0800 Safari[49476:1264368] [RemotePlistController] The downloaded plist could not be loaded: Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
2018-12-13 16:25:47.128105+0800 Safari[49476:1264277] Scheduling the NSURLConnection loader is no longer supported.
2018-12-13 16:25:47.491811+0800 Safari[49476:1264370] NSURLConnection finished with error - code -1100
2018-12-13 16:25:47.799590+0800 Safari[49476:1264514] [CloudBookmarks] Error fetching remote migration state: Error Domain=com.apple.SafariBookmarksSync.CloudBookmarksErrorDomain Code=0 "(null)"
2018-12-13 16:25:47.953259+0800 Safari[49476:1264277] [WebKit2Callbacks] Page (pid: 0) did become unresponsive
2018-12-13 16:25:47.970927+0800 Safari[49476:1264512] NSURLConnection finished with error - code -1100
2018-12-13 16:25:48.032647+0800 Safari[49476:1264425] [RemotePlistController] The downloaded plist could not be loaded: Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
2018-12-13 16:25:48.125530+0800 Safari[49476:1264426] Calling IOPPFGetProperty simulator_utility_clamp!
2018-12-13 16:25:48.840769+0800 Safari[49476:1264277] [WebKit2Callbacks] Page (pid: 49481) did become responsive

现在我已经用完了所有选项。它缺少Apple Developer网站上的官方文档。

是否有常规步骤来解决此类问题?是否有任何系统日志可以帮助我解决错误?任何建议表示赞赏。

2 个答案:

答案 0 :(得分:0)

检查您应用的代码签名是否有效。 Safari否则将拒绝列出您的扩展名。在构建的应用程序上运行codesign,如下所示:

codesign -d --verify --verbose=3 ~/Library/Developer/Xcode/DerivedData/OnePassword-epeydspviethpabprcrsqenrkiin/Build/Products/Debug_WebStore/1Password\ 7.app

它应该显示valid on disksatisfies its Designated Requirement。否则,即使启用Allow Unsigned Extensions,Safari也将完全忽略您的扩展名。

答案 1 :(得分:0)

确保扩展.appex被列为您的App Extension目标的嵌入式内容。否则,当您从Xcode构建时,它不会被捆绑。在项目编辑器中的“目标名称>常规>框架,库和嵌入式内容”下查找。该扩展名应在此处列出。

还要检查“构建阶段”选项卡下的>依赖项,也将扩展名也添加到那里。