react-native-push-notification / ios

React Native Push Notification API for iOS.
MIT License
740 stars 284 forks source link

Where can I put this code? #264

Open waheedshabeer opened 3 years ago

waheedshabeer commented 3 years ago

//Called when a notification is delivered to a foreground app. -(void)userNotificationCenter:(UNUserNotificationCenter )center willPresentNotification:(UNNotification )notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge); }

yabsi commented 3 years ago

didFinishLaunchingWithOptions already exists in your AppDelegate.m file, so add the

UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;

lines before the return statement and for the other method just make sure its under @implementation AppDelegate