Apple Push Notifications:没有收到设备令牌?

NSNoob

在涉及推送通知的应用程序中,我可以正常接收设备令牌,但是我的客户端的设备无法接收设备令牌(因此导致无法接收推送通知)。我正在使用Parse进行推送通知。这就是我所拥有的AppDelegate

-(void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken {
    // Store the deviceToken in the current installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:newDeviceToken];
    PFACL *objectACL = [[PFACL alloc] init];
    [objectACL setPublicReadAccess:YES];
    [objectACL setPublicWriteAccess:YES];

    [currentInstallation saveInBackground];
}

-(void) application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{

    NSString *errorString = [NSString stringWithFormat:@"%@", error];
    UIAlertView *errorAlertView = [[UIAlertView alloc] initWithTitle:@"Error" message:errorString delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];

    [errorAlertView show];
}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
    [application registerForRemoteNotifications];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [Parse setApplicationId:PARSE_APPLICATION_ID
                  clientKey:PARSE_CUSTOMER_KEY];
    [PFFacebookUtils initializeFacebook];

    [self.window makeKeyAndVisible];

    // create the Login controller instance:

    [application registerForRemoteNotificationTypes:
     UIRemoteNotificationTypeBadge |
     UIRemoteNotificationTypeAlert |
     UIRemoteNotificationTypeSound];
}

客户端未收到任何表示无法向APN注册的UIAlert,因此didFailToRegisterForRemoteNotificationsWithError不会调用任何方法。我已尝试按照Apple技术说明TN2265的指导从我的解析服务器中删除所有安装,删除该应用程序并重新安装。该应用程序不会在第一次启动时提示客户端授权推送通知,也不会出现在通知中心(这也令人困惑,因为didRegisterUserNotificationSettings:那里也很令人困惑)。但这一切在我的iPad,iPhone 5S,iPod 5,iPhone 4s上都可以正常工作。任何想法可能导致此设备在应用程序中出现设备变量行为吗?这是sc客户端发送给我的。notificationCenterScreenShot

苏尼尔·扎拉瓦迪娅(Sunil Zalavadiya)

尝试以下代码

    if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
    {
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    }
    else
    {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
         (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptionsAppDelegate类中的方法

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

有没有办法使用Apple Push Notification Service验证设备令牌?

来自分类Dev

iOS:Apple Push Notifications理解

来自分类Dev

如何测试Apple Push Notifications反馈服务?

来自分类Dev

WebApi应用程序的Apple Push Notifications

来自分类Dev

Windows Server上的Apple Push Notifications证书

来自分类Dev

如何测试Apple Push Notifications反馈服务?

来自分类Dev

某些设备不接收Apple Push通知

来自分类Dev

某些设备不接收Apple Push通知

来自分类Dev

当服务器上没有显示错误时如何调试ios客户端的Apple Push Notifications

来自分类Dev

当服务器上没有显示错误时如何调试ios客户端的Apple Push Notifications

来自分类Dev

Windows Server 2008上的Apple Push Notifications无法正常工作

来自分类Dev

适用于服务器的Apple Push Notifications服务

来自分类Dev

Apple Push Notifications在虚拟机上不起作用

来自分类Dev

如何以Apple Push Notification Service提供商的身份获取设备令牌?

来自分类Dev

使用UIwebview应用从设备获取UID以获得Apple Push通知

来自分类Dev

离线Apple Push Notification有效性

来自分类Dev

如何在没有钥匙串的情况下创建Apple Push Certificate?

来自分类Dev

处理Apple Push Notification Service

来自分类Dev

Rails App的Apple Push Notification

来自分类Dev

是否有人将Node.js与Amazon SNS和Apple Push Notifications一起使用?

来自分类Dev

如果您无法使用端口2195,如何使用Apple Push Notifications?

来自分类Dev

为什么我们不能再在Delphi Seattle上启用Apple Push Notifications?

来自分类Dev

how to debug apple push notifications ot ios client when it shows no error on server

来自分类Dev

如何为iOS版本9 + 10(甚至8)实现Apple Push Notifications?

来自分类Dev

Apple Push Notification Service已连接,但未收到任何通知

来自分类Dev

Apple Push Notification Service SSL(沙盒和生产)-尚未收到生产通知吗?

来自分类Dev

获取新的Apple设备令牌?

来自分类Dev

APNs Distribution iOS和Apple Push Services有什么区别?

来自分类Dev

后台问题中的Apple Push Notification

Related 相关文章

  1. 1

    有没有办法使用Apple Push Notification Service验证设备令牌?

  2. 2

    iOS:Apple Push Notifications理解

  3. 3

    如何测试Apple Push Notifications反馈服务?

  4. 4

    WebApi应用程序的Apple Push Notifications

  5. 5

    Windows Server上的Apple Push Notifications证书

  6. 6

    如何测试Apple Push Notifications反馈服务?

  7. 7

    某些设备不接收Apple Push通知

  8. 8

    某些设备不接收Apple Push通知

  9. 9

    当服务器上没有显示错误时如何调试ios客户端的Apple Push Notifications

  10. 10

    当服务器上没有显示错误时如何调试ios客户端的Apple Push Notifications

  11. 11

    Windows Server 2008上的Apple Push Notifications无法正常工作

  12. 12

    适用于服务器的Apple Push Notifications服务

  13. 13

    Apple Push Notifications在虚拟机上不起作用

  14. 14

    如何以Apple Push Notification Service提供商的身份获取设备令牌?

  15. 15

    使用UIwebview应用从设备获取UID以获得Apple Push通知

  16. 16

    离线Apple Push Notification有效性

  17. 17

    如何在没有钥匙串的情况下创建Apple Push Certificate?

  18. 18

    处理Apple Push Notification Service

  19. 19

    Rails App的Apple Push Notification

  20. 20

    是否有人将Node.js与Amazon SNS和Apple Push Notifications一起使用?

  21. 21

    如果您无法使用端口2195,如何使用Apple Push Notifications?

  22. 22

    为什么我们不能再在Delphi Seattle上启用Apple Push Notifications?

  23. 23

    how to debug apple push notifications ot ios client when it shows no error on server

  24. 24

    如何为iOS版本9 + 10(甚至8)实现Apple Push Notifications?

  25. 25

    Apple Push Notification Service已连接,但未收到任何通知

  26. 26

    Apple Push Notification Service SSL(沙盒和生产)-尚未收到生产通知吗?

  27. 27

    获取新的Apple设备令牌?

  28. 28

    APNs Distribution iOS和Apple Push Services有什么区别?

  29. 29

    后台问题中的Apple Push Notification

热门标签

归档