How to access current firebase user from iOS Today Extension?

后端 未结 1 696
感情败类
感情败类 2021-01-13 14:50

We\'re building a today widget on top of our iOS app which is working with Firebase. However we\'re struggling to access current signed-in user from the extension. The user

相关标签:
1条回答
  • 2021-01-13 15:07

    You can share data between Host App and App Extension only using App Group. There is no way of direct communication between your Host App and App Extension.

    Even though an app extension bundle is nested within its containing app’s bundle, the running app extension and containing app have no direct access to each other’s containers.

    App Group is a shared container used by both Host App as well as App Extension. It is like UserDefaults that store key-value pairs.

    So you can save your current user information in App Group from Host App and then access it in your Today Extension from the same App Group.

    For more on App Groups refer to: https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html

    0 讨论(0)
提交回复
热议问题