IOS 9推送通知 - didRegisterForRemoteNotificationsWithDeviceToken未被调用

时间:2016-04-27 18:09:52

标签: ios push-notification token

我正在使用带ios 9.3的iphone

        protected FilterResults performFiltering(CharSequence prefix) {
            return pFilter.performFiltering(prefix == null ? null :
              sParent.normaliseAcronym(prefix.toString()));
        }
    }
}

通知注册后,此方法为:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.

    UIUserNotificationType types = (UIUserNotificationType) (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert);

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

    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];

    return YES;
}

在[application registerForRemoteNotifications]之后,出现系统弹出窗口,我接受通知但方法是:

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

永远不会打电话,我缺少什么?

这适用于ios 8

1 个答案:

答案 0 :(得分:0)

好吧,这可能听起来很愚蠢,但它开始工作,而不改变一行代码...... 这是在重启wifi路由器和计算机后发生的,也许路由器阻止了连接。

感谢您的回答,如果有人遇到类似问题,请查看此帖子:didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegister...Settings is