4

I've created an iphone app with push notification feature. The server works well and I could receive the notification when app is running in foreground. The function

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 

is called then notification arrives. However, when I press the home key, brought the app into background or kill it in the task bar. I cannot receive any notification, neither in the notification area or any popup.

Anyone knows the reason? Thanks

RickyHu
  • 41
  • 2
  • Did you check the notification center? In the settings of the device, go to Notifications -> you app name, see if you have notifications enabled as popup, banner or none. – Eren Beşel Jul 30 '12 at 12:19
  • I checked it, it's all enabled. – RickyHu Jul 30 '12 at 15:43
  • @ErenBeşel: did you find solution? im facing same issue. – user836026 Jan 22 '13 at 09:49
  • @user836026 I wasn't the one having the issue. As for you though, [this](http://stackoverflow.com/questions/5056689/didreceiveremotenotification-when-in-background) would help – Eren Beşel Jan 25 '13 at 13:09

1 Answers1

1

You can use...

-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    if (launchOptions != nil) {
        NSMutableDictionary *dic = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
        NSMutableDictionary *dicItem = [dic objectForKey:@"aps"];
        NSString *itemNotification = [dicItem objectForKey:@"alert"];
    }else if (launchOptions == nil){
        NSLog(@"launch ,,, nil");
    }
...//code something
}

itemNotification is an item in Notification barge. Have fun!!

VirCrass
  • 11
  • 1