Skip to content

Commit

Permalink
Fixed warning in iOS when local notifications are received while in t…
Browse files Browse the repository at this point in the history
…he background.

#3734
  • Loading branch information
shannah committed Sep 16, 2023
1 parent ae2afee commit e3e512d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Ports/iOSPort/nativeSources/CodenameOne_GLAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,16 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNot


- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {


if (@available(iOS 10, *)) {
if( [response.notification.request.content.userInfo valueForKey:@"__ios_id__"] != NULL)
{
CN1Log(@"Received local notification while in background: %@", response.notification);
// Note: We currently don't do anything at this point. THe local notification callback
// will be triggered when the user clicks on the notification.
completionHandler();
return;
}
}
#ifdef INCLUDE_CN1_PUSH
NSLog( @"Handle push from background or closed" );
// if you set a member variable in didReceiveRemoteNotification, you will know if this is from closed or background
Expand Down

0 comments on commit e3e512d

Please sign in to comment.