1

I try to implement push notification in my iPhone application. I have create Provisioning Profile and App-id for push notification and add this certificates into Xcode. Connect iPhone device to mac system and build application through device for read Device token using the following code.

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken:\n%@", deviceToken);
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    NSLog(@"didFailToRegisterForRemoteNotificationsWithError:%@", [error localizedDescription]);
}

But it returns error.. like

didFailToRegisterForRemoteNotificationsWithError:no valid 'aps-environment' entitlement string found for application 2012-07-18 14:18:08.597 Z2NotifyMe[1874:707] didFailToRegisterForRemoteNotificationsWithError:Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x11fee0 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

I have remove all old certificates in Xcode and my device, then re-create all certificate newly then execute above same code it returns same above error.

Please help solve this problem.

Thanks..

4

3 回答 3

0

使用以下代码注册您的设备:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

applicationDidFinishLaunching:方法中。

我希望您尝试使用的设备没有越狱。

于 2012-07-18T10:23:28.143 回答
0

当我正确执行所有步骤时,我遇到了类似的问题,但我仍然收到此错误。

尝试执行以下步骤,它对我有帮助:
1)转到您的配置文件 -> 配置
2)在您的应用程序配置文件附近按右侧的“编辑”按钮 - > 然后修改
3)在此处进行一些更改,它改变是什么并不重要,这只是为了触发一个新的配置文件。取消选择其中一个设备,或更改名称,您可以稍后将其更改回来。
4) 按“提交”按钮
5) 下载配置文件并将其拖到 Xcode。(之前在 Xcode 中删除您的旧配置文件)

于 2012-07-18T11:19:31.073 回答
0

当您的代码签名身份未启用推送通知时,会出现此问题。看看这个链接:

http://mobiforge.com/developing/story/programming-apple-push-notification-services

http://blog.martinreichart.com/2010/01/getting-iphone-push-notifications-to-work/

于 2012-07-18T10:57:01.107 回答