React-native-fcm: [IOS] App crash on launch

Created on 19 Feb 2017  路  8Comments  路  Source: evollu/react-native-fcm

after edit AppDelegate.m

"react": "15.4.2",
"react-native": "0.40.0",
"react-native-fcm": "git+https://github.com/evollu/react-native-fcm.git#cf61b74fa6d00f7c56945e755866eb06186bbcea",

when i comment [FIRApp configure];
the app stop crashing

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import "RNFIRMessaging.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"leaguebet"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  [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 (^)())completionHandler
{
  [RNFIRMessaging didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
}

@end

Most helpful comment

I have resolve my issue
On your Xcodeproj create a new group names Ressources and past your GoogleService-Info.plist
And run the app

All 8 comments

I'm having the same issue. when I comment [FIRApp configure];
the app stop crashing. Is this correct solution? I have react-native 0.41.2 and react": "15.4.2",

i have "react": "15.4.2" and "react-native": "0.41.2" and it works for me.
Did both of you install with cococa pods ?
If yes, i recommend to install it manually (without cocoa pods), it's a easy process and it solve all my problems that i had.

PS: i just remember have you added your GoogleService-Info.plist file in iOS and google-services.json in android?
Give more details log of error ?

yes, my pod version is 1.2.0

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '7.0'

target 'leaguebet' do
  pod 'Google-Mobile-Ads-SDK'
  pod 'Firebase/Messaging'
end

@BeudyZlip check my comment again, i did an edit.

I have resolve my issue
On your Xcodeproj create a new group names Ressources and past your GoogleService-Info.plist
And run the app

@BeudyZlip @flaviotobi Thanks. I'll check it out. I'm also using cocopods

thanks @BeudyZlip you solved my problem

There is some bug in Xcode.
In my case, Drag-and-Dropping .plist file didn't work.

I recommend using Add Files to.. in the right click menu

Was this page helpful?
0 / 5 - 0 ratings