Active notification in iOS8 not opening app

Actually I am working in a valid notification. Everything works well, I get the trigger button action, but the problem is that I press a button that the application does not open. When I manually open the app, it triggers the appropriate action and goes to the exact screen, but it doesn't happen when I click the button.

This is my valid notification setting

NSString * const NotificationCategoryIdent  = @"ACTIONABLE";
NSString * const NotificationActionOneIdent = @"ACTION_ONE";
NSString * const NotificationActionTwoIdent = @"ACTION_TWO";

-(UIMutableUserNotificationCategory*)registerActions {

    UIMutableUserNotificationAction *action1;
    action1 = [[UIMutableUserNotificationAction alloc] init];
    [action1 setActivationMode:UIUserNotificationActivationModeBackground];
    [action1 setTitle:@"Open"];
    [action1 setIdentifier:NotificationActionOneIdent];
    [action1 setDestructive:NO];
    [action1 setAuthenticationRequired:NO];

    UIMutableUserNotificationAction *action2;
    action2 = [[UIMutableUserNotificationAction alloc] init];
    [action2 setActivationMode:UIUserNotificationActivationModeBackground];
    [action2 setTitle:@"Delete"];
    [action2 setIdentifier:NotificationActionTwoIdent];
    [action2 setDestructive:NO];
    [action2 setAuthenticationRequired:NO];

    UIMutableUserNotificationCategory *actionCategory;
    actionCategory = [[UIMutableUserNotificationCategory alloc] init];
    [actionCategory setIdentifier:NotificationCategoryIdent];
    [actionCategory setActions:@[action1, action2]
                    forContext:UIUserNotificationActionContextDefault];

    NSSet *categories = [NSSet setWithObject:actionCategory];
    UIUserNotificationType types = (UIUserNotificationTypeAlert|
                                    UIUserNotificationTypeSound|
                                    UIUserNotificationTypeBadge);

    UIUserNotificationSettings *settings;
    settings = [UIUserNotificationSettings settingsForTypes:types
                                                 categories:categories];


    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];

    return actionCategory;
 }

      

What could be the exact problem? Can someone help me .. Thanks in advance.

+3


source to share


1 answer


[action1 setActivationMode:UIUserNotificationActivationModeBackground];

      

Should be:



[action1 setActivationMode:UIUserNotificationActivationModeForeground];

      

This is what launches your application after the button is pressed.

+6


source







All Articles