小编Mat*_*teo的帖子

Push Parse - didFinishLaunchingWithOptions中的launchOptions为null

我知道这是一个已经回答的问题.

但在阅读了很多消息后,我的问题仍然存在.

使用parse我发送了这个json push:

{"aps" : { "alert" : "text msg", "badge" : 1, "sound" : "chime" }, "_3Y" : "0"}
Run Code Online (Sandbox Code Playgroud)

如果app处于活动状态,那么就可以了,userInfo正确接收我的数据:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
[PFPush handlePush:userInfo];
...
}
Run Code Online (Sandbox Code Playgroud)

如果应用程序处于空闲状态,则会显示徽章和文本通知,但是:

如果我点击通知栏上的文字,应用程序就会启动,我会收到推送

如果我点击徽章,应用程序会启动,但didFinishLaunchingWithOptions中的launchOptions为空!

这是我对didFinishLaunchingWithOptions方法的测试代码:

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

    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

    NSDictionary *aPushNotification = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
//    NSDictionary* aPushNotification = [launchOptions valueForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];

    NSString *test = [aPushNotification objectForKey:@"_3Y"];

    [[[UIAlertView alloc] initWithTitle:test message:[aPushNotification description] delegate:NULL cancelButtonTitle:NSLocalizedString(@"LOC018", @"Ok") otherButtonTitles:nil, nil] show];
...
}
Run Code Online (Sandbox Code Playgroud)

也许是一个Parse问题?

任何帮助,将不胜感激..

提前致谢!!

push-notification ios parse-platform

0
推荐指数
1
解决办法
2449
查看次数

标签 统计

ios ×1

parse-platform ×1

push-notification ×1