I am using Xcode 11.2.1 and iOS 13.2.2.
I use the method bellow to handle remote notification and it works correctly, but the problem happen when I switch Off the device and switch on again... then insert the pin without opening my app, when I send push, I receive the push but the method bellow not call always, does anybody has the same issue?
this is the payload which I send from server:
{"aps":{"content-available": 1,"alert":"Testing.. (100)","badge":1,"sound":"default"}}
and this is the code when I receive push:
-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void
(^)(UIBackgroundFetchResult))completionHandler
{
if( [UIApplication sharedApplication].applicationState == UIApplicationStateInactive )
{
NSLog( @"INACTIVE" );
completionHandler( UIBackgroundFetchResultNewData );
}
else if( [UIApplication sharedApplication].applicationState == UIApplicationStateBackground )
{
NSLog( @"BACKGROUND" );
completionHandler( UIBackgroundFetchResultNewData );
}
else
{
NSLog( @"FOREGROUND" );
completionHandler( UIBackgroundFetchResultNewData );
}
}