当Safari应用程序扩展未出现在Safari首选项中时,如何进行故障排除



我正在开发Safari应用程序扩展。以前它运行良好。当我在Xcode中运行项目,并在Safari中启用允许无符号扩展时,我可以在Safari Preferences->Extensions页面中看到我的扩展。

在我将代码与我的一名团队成员合并后,扩展突然无法安装。

我试过:

  • 清理Xcode中的构建文件夹,然后再次运行。但运气不好
  • 重新启动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

现在我没有选择了。它在苹果开发者网站上缺乏官方文档。

是否有常规步骤来解决此类问题?有什么类型的系统日志可以帮助我解决错误吗?欢迎提出任何建议。

确保扩展.appex列为应用程序扩展目标的嵌入内容。否则,当您从Xcode构建时,它就不会被捆绑。在项目编辑器中的Target_Name>General>Frameworks,Libraries and Embedded Content下查找。扩展名应该列在那里。

还要检查"构建阶段"选项卡>"依赖项"下是否也添加了扩展。

检查应用程序的代码签名是否有效。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。如果没有,Safari将完全忽略您的扩展,即使启用了Allow Unsigned Extensions

我最近在更新到Xcode 13.2.1和MacOS更新后遇到了类似的问题。我正在开发的Safari网络扩展已停止显示在Safari中(即使启用了未签名的扩展(。

在Terminal/CLI shell中,我最终运行了:

PATH=/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support:"$PATH"
lsregister -f /Applications/Safari.app

突然间,我的扩展再次出现在Safari中。Safari和LaunchServices发生了一些奇怪的事情。

相关内容

  • 没有找到相关文章

最新更新