【问题标题】:ios 8 doesn't pop the permission for notification when installing the appios 8 安装应用时不弹出通知权限
【发布时间】:2015-07-04 03:56:16
【问题描述】:

在较低版本的 IOS 上一切正常,我的推送通知代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
        if ([application respondsToSelector:@selector(registerUserNotificationSettings:)])
        {
                UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert) categories:nil];
                [application registerUserNotificationSettings:settings];
        }
        else
        {
            UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
            [application registerForRemoteNotificationTypes:myTypes];
        }
        application.applicationIconBadgeNumber = 0;
}

#ifdef __IPHONE_8_0
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
    //register to receive notifications
    [application registerForRemoteNotifications];
}

//for sielent notifications
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler
{
}
#endif

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    NSLog(@"My token is: %@", deviceToken);
}

1) 首次运行时,即使我使用 [[UIApplication sharedApplication] registerForRemoteNotifications] 重新调用请求权限的推送通知弹出窗口,也不会调用它;弹出窗口未显示。

【问题讨论】:

  • 您是否在创建 APNS 证书后创建并分配了新的配置文件?

标签: ios8 push-notification


【解决方案1】:

确保为您的App ID 配置了推送通知。
如果没有,设备将忽略任何与推送相关的方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-30
    • 1970-01-01
    相关资源
    最近更新 更多