简体   繁体   English

为 Safari 应用程序扩展设置全局设置的最佳方法是什么?

[英]What is the best way to set global settings for Safari app extension?

As this official document said, I put safari.extension.settings.test = "test" in my injected script, and it didn't work with an error:正如这个官方文档所说,我将safari.extension.settings.test = "test"放在我注入的脚本中,但它没有出现错误:

TypeError: undefined is not an object (evaluating 'safari.extension.settings.test = "test"')

And I noticed that this setting api might have been depreciated?我注意到这个设置api可能已经贬值了? apple forums苹果论坛

So what's the best way now to read/write global settings through the injected script or somewhere else?那么现在通过注入的脚本或其他地方读取/写入全局设置的最佳方法是什么?

The old Safari Extensions API is deprecated !旧的 Safari 扩展 API 已弃用 Please check the Safari App Extensions API instead.请改为检查Safari App Extensions API

The easiest way would be to store your settings in UserDefaults , like a classic iOS/Mac app.最简单的方法是将您的设置存储在UserDefaults ,就像经典的 iOS/Mac 应用程序一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM