Apple Notification Device令牌更改 [英] Apple Notification Device Token change
问题描述
更新应用后,我遇到了问题.我正在以这种格式获取设备令牌
C43461D5-E9CB-4C10-81F8-020327A07A62
并且通知无效.
I'm facing an issue after updating my app. I'm getting a device token in this format
C43461D5-E9CB-4C10-81F8-020327A07A62
and the notifications aren't working.
之前,我收到过以下格式的通知:
2add70865401171c7ca1d3b3957b719eaf721fef8f8d7a52bc91ef8a872cc004
Before, I had a notification in this format:
2add70865401171c7ca1d3b3957b719eaf721fef8f8d7a52bc91ef8a872cc004
我确实允许该应用的通知,但我在后端没有做任何更改.谁能指导我为什么它不起作用?
I did allow notifications for the app and I've not changed anything in the backend. Can anyone guide me why it's not working?
didFinishLaunchingWithOptions
中的代码:
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
获取设备令牌:
NSString *deviceTokenID = [[NSUserDefaults standardUserDefaults] objectForKey:DEVICE_TOKEN_PUSH_NOTI];
if ([deviceTokenID isEqualToString:@""] || deviceTokenID == nil) {
NSString *tempApplicationUUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
[dics setObject:tempApplicationUUID forKey:@"cust_device_id"];
} else {
[dics setObject:[[NSUserDefaults standardUserDefaults] objectForKey:DEVICE_TOKEN_PUSH_NOTI] forKey:@"cust_device_id"];
}
我遇到以下错误:
Code = 3000找不到有效的'aps-environment'授权字符串 应用程序" UserInfo = {NSLocalizedDescription =无效 找到适用于应用程序的"aps-environment"授权字符串},无效 找到适用于应用程序的"aps-environment"授权字符串
Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo={NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}, no valid 'aps-environment' entitlement string found for application
推荐答案
单击.xcodeproj->功能->启用推送通知
Click on .xcodeproj -> Capabilities -> Enable Push Notification
这篇关于Apple Notification Device令牌更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!