5

I am trying to enable push notifications on my existing iOS app. I have gone through all the steps mentioned on this webpage:

http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1

Everything on the server side is implemented. I created a new certificate for push notifications, and I ran my app using the existing provisioning profile I have. Yet it doesn't ask me for permissions for push notifications. Maybe I have missed something out? Or do I have to create new provisioning profiles? I am using a wildcard provisioning profile.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rameez Hussain
  • 6,414
  • 10
  • 56
  • 85

1 Answers1

4

iOS prompts for permission when your app calls application:registerForRemoteNotificationTypes: generally called in your Application's application:didFinishLaunchingWithOptions method.

Don't forget to send the device token to your APNs server in the application:didRegisterForRemoteNotificationsWithDeviceToken: delegate method.

You will most likely need to update your app to add such functionality, and update the App ID and provisioning profile to allow APNs.

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143
  • How do I update the provisioning profiles and app? That's what I have missed I guess. – Rameez Hussain Jun 25 '13 at 13:52
  • @RameezHussain, provisioning profiles include an App ID. You set these up through developer.apple.com. You must have an App ID that is specifically for your app (not a wildcard app id). In the developer portal, click on the App ID for your app. If it doesn't have Push Notifications enabled, enable it, then create a new provisioning profile from the App ID that has push notifications enabled. Build with the new profile. – Marcus Adams Jun 25 '13 at 13:58
  • @RameezHussain, though it seems like you would have already enabled this in your App ID, because that's where you create the certificates. So, make sure your provisioning profile includes this App ID and refresh your profiles in XCode through the Organizer. – Marcus Adams Jun 25 '13 at 14:06
  • I try to create a new provisioning profile on the portal, using the app ID on which I have enabled the push notifications. But each time I try to refresh the list on the organizer in XCode, it generates one with a wildcard app ID. I have no idea why and the code you suggested doesn't work. :( – Rameez Hussain Jun 25 '13 at 14:52
  • @RameezHussain, once you download the new provisioning profile, you must select it in XCode in the build settings. – Marcus Adams Jun 25 '13 at 17:30