Unable to inject isHeadless prop via AppDelegate.m in expo-bare #4205
-
The docs cover how to do this in a bare react-native app, however expo-bare's AppDelegate.m does not follow the same structure. Here's a link to the documentation: https://rnfirebase.io/messaging/usage#background-application-state Any assistance would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
They split things, yes, so it is not all in one method. I believe you will need to store state in 'self' in one method in order to refer to it in another. Add another line around here: https://github.com/expo/expo/blob/2b480843941b488ea7c256d97446f933cc21417b/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.m#L36 that references the appProperties NSDictionary pointer, in the same style. Here is the start of the method you need to modify: You must do a FIRApp configure, yes? You should do that first. Then somewhere after that but before RCTRootView alloc, add this to set your new NSDictionary pointer
Then when you launch here https://github.com/expo/expo/blob/2b480843941b488ea7c256d97446f933cc21417b/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.m#L66 set initialProperties to self.initialProperties (the property holding the NSDictionary pointer you set earlier) Should work? Please report back and let us know! |
Beta Was this translation helpful? Give feedback.
-
@mikehardy Hey Mike, I am facing exactly the same issue with react-native 0.69.1 in AppDelegate.mm file. Can you please take a look at my question and see if you can provide me as well with a solution? https://stackoverflow.com/questions/73106342/how-to-inject-the-firebase-messaging-isheadless-prop-into-appdelegate-mm-file-wi Thank you very much! |
Beta Was this translation helpful? Give feedback.
-
@chahinramonaghrim This is what I did in AppDelegate.mm using react-native 0.69.4 and expo 46.0.2
|
Beta Was this translation helpful? Give feedback.
They split things, yes, so it is not all in one method. I believe you will need to store state in 'self' in one method in order to refer to it in another.
Add another line around here: https://github.com/expo/expo/blob/2b480843941b488ea7c256d97446f933cc21417b/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.m#L36 that references the appProperties NSDictionary pointer, in the same style.
Here is the start of the method you need to modify:
https://github.com/expo/expo/blob/master/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.m#L41
You must do a FIRApp configure, yes? You should do that first.
Then somewhere after that but before RCTRootView alloc, add this t…