diff --git a/ios/RNFirebase/RNFirebaseMessaging.m b/ios/RNFirebase/RNFirebaseMessaging.m index f027cfb0..bc8800c8 100644 --- a/ios/RNFirebase/RNFirebaseMessaging.m +++ b/ios/RNFirebase/RNFirebaseMessaging.m @@ -296,7 +296,7 @@ RCT_EXPORT_METHOD(requestPermissions:(RCTPromiseResolveBlock)resolve rejecter:(R #endif } - [[UIApplication sharedApplication] registerForRemoteNotifications]; + [RCTSharedApplication() registerForRemoteNotifications]; } RCT_EXPORT_METHOD(subscribeToTopic: (NSString*) topic) @@ -380,10 +380,10 @@ RCT_EXPORT_METHOD(cancelLocalNotification:(NSString*) notificationId) if([UNUserNotificationCenter currentNotificationCenter] != nil){ [[UNUserNotificationCenter currentNotificationCenter] removePendingNotificationRequestsWithIdentifiers:@[notificationId]]; }else { - for (UILocalNotification *notification in [UIApplication sharedApplication].scheduledLocalNotifications) { + for (UILocalNotification *notification in RCTSharedApplication().scheduledLocalNotifications) { NSDictionary *notificationInfo = notification.userInfo; if([notificationId isEqualToString:[notificationInfo valueForKey:@"id"]]){ - [[UIApplication sharedApplication] cancelLocalNotification:notification]; + [RCTSharedApplication() cancelLocalNotification:notification]; } } } diff --git a/tests/ios/ReactNativeFirebaseDemoTests/ReactNativeFirebaseDemoTests.m b/tests/ios/ReactNativeFirebaseDemoTests/ReactNativeFirebaseDemoTests.m index fd9d570c..7b97a0b5 100644 --- a/tests/ios/ReactNativeFirebaseDemoTests/ReactNativeFirebaseDemoTests.m +++ b/tests/ios/ReactNativeFirebaseDemoTests/ReactNativeFirebaseDemoTests.m @@ -37,7 +37,7 @@ - (void)testRendersWelcomeScreen { - UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; + UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; BOOL foundElement = NO;