Post

Replies

Boosts

Views

Activity

Why can't I access the right UserDefaults?
I'm making a Safari App Extension and I want to store some user data with UserDefaults. Using the defaults command line utility, I've set up a com.willwhite.AppName-Extension domain with an underlying plist file with some test values.In my SafariExtensionHandler code, I have this line: let userDefaults = UserDefaults(suiteName: "com.willwhite.AppName-Extension")What I get as the value of userDefaults is, I believe, the standard defaults object (it's the same object as what I get when I pass nil as the suiteName). I'm expecting it to be the defaults that I've set up for my extension using the defaults command line utility. Please could you tell me what is going wrong?
0
0
407
May ’20
How to persist data for Safari App Extensions?
I've seen a couple of answers for how to persist settings/preferences, but I want to persist larger amounts of data, data that the user will input as they're using my extension. I can't see a recommended approach to this in the Safari App Extension documentation. Before I go looking through the wider macOS development documentation, I'd like to know if there's an idiomatic way to store data for Safari App Extensions.The data is used in the injected script. Currently, I have hardcoded data into the script so that I can use the extension. I've thought about putting this data in a JSON file and including that in the extension's resources, but I can't access the file from the script. My next thought is to pass the data to and from the extension's Swift code, and get the Swift code to store it somehow. Failing that, I would try to pass the data to and from the containing app, and get that to store it.Any guidance would be appreciated.
0
0
449
May ’20
How to make a Safari App Extension in Xcode 11.4.1 that'll work in macOS 10.14?
I've tried changing the project, app and extension deployment target to 10.14, but no luck. The error reported by my user is along the lines of "This file cannot be opened" (they're trying to open the .app file that contains the extension). I'm expecting opening the file to open the containing app, and from there they can add the extension to Safari (I can do this on my machine). I have Xcode 11.4.1 and macOS 10.15 only (so I'm unable to test in 10.14 myself).
0
0
390
May ’20
Application exposing an API
I'm sorry if this isn't in the right place in the forums.How could my macOS application expose an API for other macOS applications to use? I want other applications to be able to send data to my application, and my application will take care of storing that data. During development, I also want to be able to manually interact with my application via its API, eg by typing in commands.
7
0
1.9k
Apr ’20
"does not have permission to read, modify or transmit content from any webpages" even when Level set to All
Extensions Preferences is saying "Extension does not have permission to read, modify or transmit content from any webpages." but I've set SFSafariWebsiteAccess Level to All as per https://developer.apple.com/documentation/safariservices/safari_app_extensions/safari_app_extension_info_property_list_keys/adjusting_website_access_permissions. Any ideas about what might be wrong?
1
0
976
Jan ’20