【发布时间】:2023-03-19 01:54:01
【问题描述】:
我多次编辑和修改配置文件。我也在文本编辑器中检查了它。配置文件一切正常。但仍然推送通知不起作用。我得到了这个错误。每个人都说它的 bcz 错误的配置文件,但我的配置文件值与 Apple 在其文档中所说的相同。我收到此错误:
注册错误。错误:错误域=NSCocoaErrorDomain Code=3000 "没有找到有效的 'aps-environment' 授权字符串 应用程序“用户信息=0x127d80 {NSLocalizedDescription=无效 找到应用程序的“aps-environment”权利字符串}
我的 AppDelegate.m 中的代码如下所示:
- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
}
-(void)application:(UIApplication )application didRegisterForRemoteNotificationsWithDeviceToken:(NSData )deviceToken {
NSString *deviceTokenStr = [[[[deviceToken description] stringByReplacingOccurrencesOfString: @"<" withString: @""] stringByReplacingOccurrencesOfString: @">" withString: @""] stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"DeviceTokenStr: %@",deviceTokenStr);
}
提前感谢您的帮助
【问题讨论】:
-
我发现了这个有用的链接:mobiforge.com/developing/story/…
标签: iphone xcode push-notification ios-4.2 apple-push-notifications