Remote Notification not called the application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler: correctly

Hi,

I use Normal Remote Notification and it call currectly the method bellow:


-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void
  (^)(UIBackgroundFetchResult))completionHandler
  {

NSLog( @"HANDLE PUSH, didReceiveRemoteNotification: %@", userInfo );

// custom code to handle notification content

if( [UIApplication sharedApplication].applicationState == UIApplicationStateInactive )
{
  NSLog( @"INACTIVE" );
  completionHandler( UIBackgroundFetchResultNewData );
}
else if( [UIApplication sharedApplication].applicationState == UIApplicationStateBackground )
{
  NSLog( @"BACKGROUND" );
  completionHandler( UIBackgroundFetchResultNewData );
}
else
{
  NSLog( @"FOREGROUND" );
  completionHandler( UIBackgroundFetchResultNewData );
}
}

The main problem is, when i switch off and then switch on my device and when i send the push, i see that the push arrive on my device becuase

Alert appear on my device but the method above not called, in genral it should wake up my app call method bellow.


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
}

and then call the completion handler...


However after opening my app and close it again many times (after some mins) when i send a push then it should start work currectly and the method above start to call...


Does anyone have the same issue ?

Replies

Hey Steve,


First of, I assume that you ommitted code from your didReceivePush code right? You'd normally want to do something in there with the userInfo that gets passed. I assume from "switch off and then switch on device", that you mean power off, and power back up? If so, are you expecting your app to still be running?


1. What service are you using to send your push notification?

2. Is it an Alert notification or content-available one?

3. Depending on 2, do you have the "priority" set correctly?

4. Do you have the background mode checked for remote notifications?

5. If content-available, did you ensure you didn't set alert body, sound, or badge?


From some videos it sounds like they're starting to crack down on misconfigured pushes, but that is just speculation. I haven't seen any documentation to state pushes will STOP being sent if misconfigured.