Frage

I have an app where I have push notification.

What I have is I go to respective category when push is clicked (from the push notification list).

All is working perfectly, except when the app is killed.

If the app is minimized and push comes, if I click on push, it goes to respective category.

However if I forcefully kill the app and push comes and click on the push, it just open the app and no transition occurs.

Is this natural behavior in iPhone or I am doing something wrong?

In didReceiveRemoteNotification I go to specific category based on the data I received.

War es hilfreich?

Lösung 2

Below is what I used.

-(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"];
        // do all transition here....
    }else if (launchOptions == nil){
        NSLog(@"launch ,,, nil");
    }
...//code something
}

Andere Tipps

didReceiveRemoteNotification not call app will not run, that time push notification open app newly in device, you manually check if any notifications are bending in application:didFinishLaunchingWithOptions: try this for check bending notifications in app.

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

...............
...............

 UILocalNotification *localNotif =[launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
    if (localNotif) {

        NSLog(@"load notifiation *******");
        isLoadNotification=YES;
    }
  return YES;
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top