3

I'm developing a Safari App Extension. Previously it worked fine. When I run the project in Xcode, and enable Allow Unsigned Extensions in Safari, I can see my extension in Safari Preferences -> Extensions page.

After I merged code with one of my team member, suddenly the Extension cannot get installed.

I have tried:

  • Clean the build folder in Xcode, and run again. But no luck.
  • Restart Xcode doesn't help either.
  • Use command pluginkit -mAvvv -p com.apple.Safari.extension to check installed Safari extensions list. My extension is not in the list.

There are some errors in Xcode output, but I can't link them with the issue I'm facing:

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

Now I'm running out of options. It lacks official documentation in Apple Developer site.

Is there regular steps to troubleshoot this kind of issue? Is there any kind of system logs which can help me address the error? Any suggestion is appreciated.

zhm
  • 3,513
  • 3
  • 34
  • 55

3 Answers3

2

Make sure that the extension .appex is listed as embedded content for your App Extension target. Otherwise it doesn't get bundled when you build from Xcode. Look in the project editor under Target_Name > General > Frameworks, Libraries and Embedded Content. The extension should be listed there.

Also check under the Build Phases tab > Dependencies that your extension is added there as well.

chris
  • 21
  • 3
0

Check to see if the code signature of your app is valid. Safari will refuse to list your extension otherwise. Run codesign on your built app as follows:

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

It should show valid on disk and satisfies its Designated Requirement. If it doesn't, Safari will ignore your extension completely, even when Allow Unsigned Extensions is enabled.

Dave Teare
  • 509
  • 3
  • 7
  • 1
    I get both `valid on disk` and `satisfies its Designated Requirement`, but my extension still won't show up in the Safari preferences. The problems started after I accidentally deleted the `Products` group in my project, and had to add it back in by manually editing the `.pbxproj` file. – Andreas is moving to Codidact Dec 05 '19 at 17:13
0

I had a similar problem more recently after updating to Xcode 13.2.1 and a I think a MacOS update. My Safari web extensions I was developing stopped showing up in Safari (even with unsigned extensions enabled).

In a Terminal/CLI shell, I ended up running:

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

And suddenly my extensions started showing up again in Safari. Something screwy happened with Safari and LaunchServices.

clarkn
  • 1