[英]Ways of Safari App Extension to communicate with containing app
I have a Safari App Extension that injects a button over images into a specific website and when tapping that button I want to trigger a function with some parameters in the application that contains the safari app extension ( NOT from .js to extension handler) 我有一个Safari应用程序扩展 ,可将图像上方的按钮注入到特定网站中,点击该按钮时,我想在包含Safari应用程序扩展名的应用程序中触发带有某些参数的函数( 不是从.js到扩展名处理程序)
How can I communicate from the Safari App Extension with the main app in real time? 如何从Safari App Extension与主应用程序实时通信?
NSUserDefaults
trough app groups does not seems a good idea NSUserDefaults
低谷的应用程序组似乎不是一个好主意
If you don't (can't) listen to updates of "shared user defaults" (using a group SuiteName). 如果您不(无法)收听“共享的用户默认设置”的更新(使用SuiteName组)。 Then you may try with Distributed Notifications: https://developer.apple.com/documentation/foundation/distributednotificationcenter
然后,您可以尝试使用分布式通知: https : //developer.apple.com/documentation/foundation/distributednotificationcenter
It's quite simple and similar to messaging between Content Scripts and Safari App Extension. 这非常简单,类似于Content Script和Safari App Extension之间的消息传递。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.