在iPhone(ios 8.3)设备上未收到推送通知,而它在包括ios 8.3在内的所有iPad ios版本上工作正常

在iPhone(ios 8.3)设备上未收到推送通知,而它在包括ios 8.3在内的所有iPad ios版本上工作正常,ios,objective-c,iphone,push-notification,apple-push-notifications,Ios,Objective C,Iphone,Push Notification,Apple Push Notifications,我正在我的应用程序中使用推送通知。它在包括iOS 8.3在内的所有iPad iOS版本上都能正常工作,但奇怪的是,在iPhone上却没有收到。我已经在iOS 8.3的iPhone5C和iOS 8.3的iPhone5S上进行了测试。虽然这两部iPhone正在触发推送通知事件,但没有收到它们 当单击推送通知警报的“确定”按钮时,iPhone正在生成注册设备令牌。我真不明白问题出在哪里。我还尝试创建一组新的证书、配置文件,但问题仍然是一样的。任何帮助都将不胜感激 我的代码如下 - (BOOL)appl

我正在我的应用程序中使用推送通知。它在包括iOS 8.3在内的所有iPad iOS版本上都能正常工作,但奇怪的是,在iPhone上却没有收到。我已经在iOS 8.3的iPhone5C和iOS 8.3的iPhone5S上进行了测试。虽然这两部iPhone正在触发推送通知事件,但没有收到它们

当单击推送通知警报的“确定”按钮时,iPhone正在生成注册设备令牌。我真不明白问题出在哪里。我还尝试创建一组新的证书、配置文件,但问题仍然是一样的。任何帮助都将不胜感激

我的代码如下

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
.....
    [self registerForRemoteNotification];

.....
    return YES;
}


- (void)registerForRemoteNotification
{
    if (IS_OS_8_OR_LATER)
    {
        UIUserNotificationType types = UIUserNotificationTypeSound | UIUserNotificationTypeBadge | UIUserNotificationTypeAlert;
        UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
    }
    else
    {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
    }
}

#ifdef __IPHONE_8_0

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

- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler
{
    //handle the actions
    if ([identifier isEqualToString:@"declineAction"])
    {
    }
    else if ([identifier isEqualToString:@"answerAction"])
    {
    }

}

#endif


- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {

.....
}



- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
    NSLog(@"Failed to get token, error: %@", error);
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

  ......
}
所以请解决我的问题。

这两部iPhone正在触发推送通知事件。这是什么意思?推送通知并非源自iPhone。我想这只是一个输入错误,你的意思是推送事件被触发到两部iPhone上

第一件事是再次检查您是否使用了正确的推送令牌,当发送到iPhone时,您实际使用的是他们的推送令牌,而不是iPad推送令牌


如果可以,那么这些是前景推送还是背景推送?如果是后台推送,请在发送推送时尝试将iPhone插入电源,然后查看是否收到了推送。

您有解决方案吗?