gpt4 book ai didi

ios - 另一个应用程序中的设备 token 更改

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:02:20 24 4
gpt4 key购买 nike

我编写了 3 个应用程序来获取 iPad 中的设备 token ,但每个应用程序都获得了不同的设备 token 。

app1:4e8eb1d864c80fd8426615cd8ca4133c8bde78c30910cd1a8b82c917b612f38d
app2:2645100209412c457e87744c0af9ff323e28f6b2195c0fa9b835ddeebfe1391b
app3:f5958b3bad17feda02e64f9814f01cfafdda0b8283977214916c3d7eaa8b8dc8

这正常吗?我查过一些信息,说同一台设备上的不同应用程序将获得相同的设备 token ……但根据我的测试,这似乎不是真的。

任何意见将不胜感激:)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
} else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeNewsstandContentAvailability];
}

return YES;

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

NSString *newToken =[deviceToken description];
newToken = [newToken stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
newToken = [newToken stringByReplacingOccurrencesOfString:@" " withString:@""];

NSLog(@"*******************");
NSLog(@"Token%@",newToken);}

-(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{
NSLog(@"errorwwwwww:%@",[error description]);}

最佳答案

这是完全正常的!

设备 token 同时识别设备 应用。想一想,这是非常有意义的,因为设备 token 用于在收到推送通知时识别 iOS 中的应用程序。如果每个应用程序都会返回设备 token ,那么一旦推送通知到达设备,iOS 将不知道将推送通知发送到哪里。

关于ios - 另一个应用程序中的设备 token 更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28339109/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com