How to communicate between iOS App Containing Extension and Extension (not Host App)

后端 未结 4 1369
攒了一身酷
攒了一身酷 2021-01-30 17:46

TLDR: Is it possible to send realtime messages or notifications between iOS App and it\'s Extension?

I\'m writing an iOS App with an extension

4条回答
  •  囚心锁ツ
    2021-01-30 18:25

    For an alternative means of doing general-purpose bidirectional communication between host app and app extension, try MMWormhole:

    http://www.mutualmobile.com/posts/mmwormhole https://github.com/mutualmobile/MMWormhole

    It’s a fairly lightweight wrapper around CFNotificationCenter, and uses “Darwin” notifications to do interprocess communication (IPC).

    It passes payloads back & forth using the apps’ shared container, and encapsulates even having to create the file(s) themselves.

    The class (and the sample app in the repo) seem to work well, and are quite responsive.

    I hope this also helps.

提交回复
热议问题