iPhone iOS push notifications apns on production not sending

后端 未结 4 1495
梦谈多话
梦谈多话 2020-12-31 10:28

I\'ve been working on this for a while now. I know there\'s a ton of articles out there, and have learned a lot about it all.

I have created my development and produ

4条回答
  •  伪装坚强ぢ
    2020-12-31 10:53

    Device token for Development and Production are not same.

    When you are testing for Production use UIAlertView to see your token for Production. Do something like the following:

    - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
    {
        [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
        NSString *deviceID = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
        deviceID = [deviceID stringByReplacingOccurrencesOfString:@" " withString:@""];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Device Token", nil) message:deviceID delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
        [alert show];
    }
    

    Use this token to push notification for production.

提交回复
热议问题