苹果推送通知:不接收设备令牌?

在涉及推送通知的应用程序中,我正在接收设备令牌,但是我的客户端设备没有收到设备令牌(因此导致无法接收推送通知)。 我正在使用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没有被调用。 我尝试从我的分析服务器中删除所有的安装,删除应用程序,并按照苹果技术说明TN2265准则再次重新安装。 应用程序在第一次启动时不会提示客户端进行推送通知授权,也不会在通知中心出现(这是因为didRegisterUserNotificationSettings:也是如此)。 但是,这一切都工作正常我的iPad,iPhone 5S,iPod 5,iPhone 4s。 任何想法可能会导致此设备设备应用程序中的variables行为?!这是sc客户端发送给我。 notificationCenterScreenShot

尝试下面的代码

  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 *)launchOptions在AppDelegate类中的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法