我編輯和修改配置文件很多次。我也在文本編輯器中檢查過它。配置文件一切正常。但仍然推送通知不起作用。我得到這個錯誤。大家都在說,它的壞配置文件的bcz,但我的配置文件值是蘋果在他們的文檔中所說的。即時得到這個錯誤:推送通知不起作用?
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}
代碼lookes像這樣在我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);
}
thanx的幫助提前
我發現這個有用的鏈接:http://mobiforge.com/developing/story/programming-apple-push-notification-services – Mahesh 2011-02-17 10:57:46