Safari App Extension doesn't load the second time

I've been having a strange issue where the second time I run my Safari app extension, it won't show up in Safari.

  1. Open Xcode.
  2. New > Project.
  3. Under Other, select Safari Extension App, then click "Next".
  4. Enter whatever you want on this "product name" screen and then click "Next".
  5. Click "Create".
  6. Run the project by clicking the Play icon in the top-left of Xcode.
  7. It will open a small app with a single button at the bottom with the text: "Open in Safari Extensions Preferences".
  8. It probably won't show up. If it does, skip to 10.
  9. Go to Develop in the title menu of Safari, click "Allow Unsigned Extensions".
  10. Once shows up, check the box to enable it.
  11. Stop Xcode from running by clicking the stop icon in the top-left.
  12. Change a value in the Info.plist of the plugin such as changing the
    SFSafariWebsiteAccess.Level
    from "Some" to "All".
  13. Click the Play icon in Xcode.
  14. Safari will tell you the extension permissions have changed. Acknowledge those changes and the extension will no longer show up.

The same thing happens if I change other values. If I leave the extension code and settings completely unchanged, no problems occur. But as soon as I change some value, it completely breaks even if I change those settings back.

This happens for me on two different Macs, both 10.13 and 10.14 with the latest Xcode.

Replies

Can you please file a radar and attach a sysdiagnose? I'd like to find out more about what's going on here.


Does the problem continue to reproduce if you quit/relaunch Safari?

I have the same problem and yes, the problem continues if you quit/relaunch Safari.


Edit: I've just found a temporary solution to this that works: https://stackoverflow.com/a/56873655/2586790

This is a known issue, but filing an issue through Feedback Assistant is always helpful!

press cmd+shift+k before build and run