推送通知不起作用? [英] Push Notification is not working?
问题描述
我多次编辑和修改配置文件.我也在文本编辑器中检查了它.配置文件一切正常.但仍然推送通知不起作用.我收到这个错误.每个人都在说它的配置文件错误,但我的配置文件值与 Apple 在他们的文档中所说的相同.我收到此错误:
i edit and modify the provisioning profile alot of times. and i checked it in text editor too. everything is ok with provisioning profile. but still push notifications are not working. and i m getting this error. everyone is saying that its bcz of bad provisioning profile but my provisioning profile values are the same as Apple said in their documentation. i m getting this error:
注册错误.错误:错误域=NSCocoaErrorDomain代码=3000找不到有效的‘aps-environment’权利字符串应用程序" UserInfo=0x127d80 {NSLocalizedDescription=无效为应用程序找到了aps-environment"权利字符串}
Error in registration. Error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x127d80 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
我的 AppDelegate.m 中的代码如下所示:
code lookes like this in my 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);
}
提前感谢帮助
推荐答案
我相信当您没有使用正确的配置文件签署应用程序时,会出现没有为应用程序找到有效的 'aps-environment' 权利字符串"错误.您必须按照 中所述为您的应用生成配置文件Mahesh 的链接).另请注意,您不能使用团队配置文件来签署需要推送通知的应用.
I believe the "no valid 'aps-environment' entitlement string found for application" error appears when you don't sign your app with the correct provisioning profile. You'll have to generate a profile for your app as described in Mahesh's link). Also note that you can't use a team provisioning profile to sign an app that requires push notifications.
这篇关于推送通知不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!