推送通知在iPhone设置中默认为无声音和无徽章

时间:2015-03-12 19:42:12

标签: ios objective-c xcode apple-push-notifications

在测试和制作中,特别是"构建我的远程推送通知带有声音和徽章应用程序图标。从商店下载应用程序时,我看到了不同的行为。我将它下载到运行iOS 8.2的手机上,当应用程序启动时我接受了远程通知。但是,在iPhone的设置中检查我的应用程序的通知设置屏幕,我找到了" Sounds"和#34;徽章App Icon"被关掉了。下面是我在应用程序委托中设置这些代码的代码。这些设置默认关闭的原因是什么?

if ([[UIApplication sharedApplication] respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{

    [[UIApplication sharedApplication]registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeSound |
                                                                        UIUserNotificationTypeAlert | UIUserNotificationTypeBadge
                                                                                                         categories:nil]];
    [[UIApplication sharedApplication]registerForRemoteNotifications];
}
else
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}

0 个答案:

没有答案