简体   繁体   中英

Running separate plugins in Cocoa

I'm trying to separate all my web rendering classes into a separate plugin following Plugin Architectures guide, but unlike Mail.app, the loaded NSBundle is running embedded in my app and not separately in a process like Mail.app. How do I mirror this behavior and have my plugins also run in separate processes?

邮件插件

For the curious, WKWebView's auto-spawn these processes when used on OSX.

As @tbodt mentioned above, XPC services is also an option but the communication interface does not allow true UI separation since there is no clear notion of a main thread for XPC - and hence you can't instantiate AppKit classes inside an XPC service.

Apple most likely uses its NSExtension APIs to host out-of-process plugins. Unfortunately while this API is public to create plugins for Apple operating systems, it is still private for apps to host their own plugins. Apple's documentation only references the old, obsolete, and unsafe CFPlugin architecture (which loads bundles directly into the host process). If you'd like this functionality for your own app, I'd highly encourage you to provide your feedback at https://feedbackassistant.apple.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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