I'am trying to receive push notification with react-native-fcm. As documentation says I'am install and implement all steps as bellow
a) Install react-native-fcm npm install react-native-fcm --save
b) Link the library with react-native link react-native-fcm
c) Download GoogleService-Info.plist file from firebase console and place it in /ios/my-project directory
d) Install Firebase Messaging with Cocoapods
pod 'Firebase/Messaging' into Podfilepod installAppDelegate.h
@import UserNotifications;
@interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate>
/*@interface AppDelegate : UIResponder <UIApplicationDelegate>*/
AppDelegate.m//...
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//...
[FIRApp configure];
[[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
return YES;
}
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
{
[RNFIRMessaging willPresentNotification:notification withCompletionHandler:completionHandler];
}
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler
{
[RNFIRMessaging didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
}
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler
{
[RNFIRMessaging didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
}
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[RNFIRMessaging didReceiveLocalNotification:notification];
}
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler
{
[RNFIRMessaging didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
````
g) Enable capabilities in xCode
Then I archive my application in ipa and try to start it on device. Application crashes after loading screen appear. Please, explan to me, where is my mistake?
PS. No one .js file are not change from create-react-native-app command.
When openning an issue, please include following information for better support
I had the same problem. In my case I was to add GoogleService-Info.plist to project via xcode, not just put file in project directory:
https://stackoverflow.com/questions/45317777/could-not-find-a-valid-googleservice-info-plist-in-your-project#answer-45318508
@akyGit Thank you very much, application started!
Most helpful comment
I had the same problem. In my case I was to add GoogleService-Info.plist to project via xcode, not just put file in project directory:
https://stackoverflow.com/questions/45317777/could-not-find-a-valid-googleservice-info-plist-in-your-project#answer-45318508