3

我編輯和修改配置文件很多次。我也在文本編輯器中檢查過它。配置文件一切正常。但仍然推送通知不起作用。我得到這個錯誤。大家都在說,它的壞配置文件的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的幫助提前

+0

我發現這個有用的鏈接:http://mobiforge.com/developing/story/programming-apple-push-notification-services – Mahesh 2011-02-17 10:57:46

回答

7

我相信「沒有有效的 'APS-環境' 的權利字符串找到應用程序「錯誤出現時,您不使用正確的供應配置文件簽名您的應用程序。您必須按照Mahesh's link中所述爲您的應用生成配置文件)。另請注意,您無法使用團隊配置文件爲需要推送通知的應用程序簽名。