1
votes

I did everything in this tutorial:

http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

I created certificates, app_id and a Provisioning profile and try to use Push Notification Service with simple code below in delegate file:

self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];

// Let the device know we want to receive push notifications
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
        (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

I tried my app on my iPad but it doesn't work. iOS doesn't ask me if I allow my app to use Push Notifications, also doesn't show my app in Settings>Notifications list. I don't get an error while compiling or running my app..

enter image description here

Error

I just implemented "didFailToRegisterForRemoteNotificationsWithError" method and I am getting this error while running application

2013-03-31 00:11:10.481 PushAppCalisma [272:907] {
    NSLocalizedDescription = "no valid 'aps-environment' entitlement string found for application";
}
2
Have you configured the App ID from the provisioning profile to support remote notifications? - Alexander
yes, I think you are asking the image above?... - cmltkt
Did you implement application:didFailToRegisterForRemoteNotificationsWithError: What error do you get? - maroux
After activating "Production Push SSL Certificate" I stated to get this error "No unexpired provisioning profiles found that contain any of the keychain's signing certificates" - cmltkt
The production certificate is for when the application is released, the development is used during the developing process. - Alexander

2 Answers

1
votes

You need to create a dev provisioning profile, linked to that specific app id (The one you created por push notifications), then remember to test it in a real device, simulator can't receive push notifications!

1
votes

All right, I solved the problem. Probably people who are new to ios and uses Push Notifications first time will make this mistake.

Solution:

Do everything in this tutorial:

http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

After, follow these steps:

1- Open XCode and open Organizer (Window>Organizer) 2- In left side pane, under Library section, click Provisioning Profile tab and refresh table. If you can't see the provisioning profile that you just created click "import" and select the "*.mobileprovision" file (tutorial explains how you create a provisioning profile and download provision file). After importing, restart Xcode, click the project name 3- In Code Signing Identity (Under Build Settings tab), set attributes to Provisioning Profile for both "Targets" and "Projects" tabs.