gpt4 book ai didi

ios - 推送通知在 ios 8 中运行良好,但在 ios 7 中运行良好

转载 作者:行者123 更新时间:2023-11-29 10:30:55 25 4
gpt4 key购买 nike

我正在尝试在应用中实现推送通知。

我已经为 ios 8 做到了。在 iPad OS 上是 ios8。我在 iPad 上收到推送通知。

iPhone 操作系统是 iOS7。每当我在 iPhone 上编译应用程序时,我都会出错

/* 获取 token 失败,错误:错误域=NSCocoaErrorDomain 代码=3000“未找到应用程序的有效‘aps 环境’授权字符串”UserInfo=0x16d246c0 {NSLocalizedDescription=未找到有效的‘aps 环境’授权字符串申请}*/

我的应用委托(delegate)方法是

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
// Let the device know we want to receive push notifications
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}

return YES;
}

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
NSLog(@"My token is: %@", deviceToken);
}

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
NSLog(@"Failed to get token, error: %@", error);
}

感谢帮助

最佳答案

该消息表明您在 iPad/iOS 7 上使用的签名证书与在 iPhone/iOS 8 上使用的签名证书不同,一个没有设置推送通知权限的证书。它与您的代码无关。

关于ios - 推送通知在 ios 8 中运行良好,但在 ios 7 中运行良好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29672740/

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