Skip to content

Commit 3e39b5a

Browse files
TissotTissot
authored andcommitted
Delayed registerForNotifications to avoid issues with Watchdog
1 parent bf425cd commit 3e39b5a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ios/AppDelegate+FCMPlugin.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,21 @@ + (void)load
3939
}
4040

4141
- (BOOL)application:(UIApplication *)application customDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
42-
4342
[self application:application customDidFinishLaunchingWithOptions:launchOptions];
44-
43+
4544
NSLog(@"DidFinishLaunchingWithOptions");
45+
[self performSelector:@selector(registerForNotifications) withObject:self afterDelay:0.3f];
4646

47+
return YES;
48+
}
49+
50+
- (void) registerForNotifications {
4751
// [START configure_firebase]
4852
if([FIRApp defaultApp] == nil) {
4953
[FIRApp configure];
5054
}
5155
// [END configure_firebase]
52-
56+
5357
// iOS 9 or earlier Disable the deprecation warnings.
5458
// [START register_for_notifications]
5559
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {
@@ -83,7 +87,6 @@ - (BOOL)application:(UIApplication *)application customDidFinishLaunchingWithOpt
8387
#endif
8488
}
8589
// [END register_for_notifications]
86-
return YES;
8790
}
8891

8992
// [START message_handling]

0 commit comments

Comments
 (0)