Safari Web Extension template throws "SFErrorDomain Code=1"

Hello dear Apple Community,
I'm pretty new to this, so probably this is a simple fix...
I just created a Safari Web Extension from the "official" template in Xcode (File > New > Project > Safari Extension App). I ran it an it popped a window open which has a button that says something like "Quit and open Safari Preferences".
I press it and nothing happens. Weirdly though, a week ago, I tried pretty much the same -> worked perfectly. But now it doesn't. So I made the button press event look like this:
Code Block swift
@IBAction func openSafariExtensionPreferences(_ sender: AnyObject?) {  SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in
            guard error == nil else {
                print(error.debugDescription)
                return
            }
            DispatchQueue.main.async {
                NSApplication.shared.terminate(nil)
            }
        }
    }

And it printed me out this error:

Optional(Error Domain=SFErrorDomain Code=1 "(null)")

What am I missing? Afaik the error means that my extension wasn't found or that I'm not the owner, but how could that be... because why would Xcode give me an invalid template?

Thanks in advance! :)



Answered by Engineer in 655911022
You'll want to make sure that you have "Allow Unsigned Extensions" checked in the Develop menu in Safari.

This is reset each time Safari is quit/restarted, so you might have had it on then, but don't have it on now.
Accepted Answer
You'll want to make sure that you have "Allow Unsigned Extensions" checked in the Develop menu in Safari.

This is reset each time Safari is quit/restarted, so you might have had it on then, but don't have it on now.
Ah shoot, now I accidentally marked you answer as a solution... it wasn't... see I'm pretty new to this all. Uhm yeah.. tried your thing but it still showed me the same error code...

Edit: can I mark the question as unsolved? This just annoys me haha

Edit 2: I've created a new question with a bit more detail including the answer to the recommendation you made. Link.
Safari Web Extension template throws "SFErrorDomain Code=1"
 
 
Q