简体   繁体   中英

registerForRemoteNotificationTypes not working?

I am trying to implement Parse Push Notifications. I have it all set up for my other app and it works great. However, I am trying to implement it in the app I am working on now. The thing is, is that I just can't get it to work.

I am doing this in the applicationDidFinishLaunching method:

[application registerForRemoteNotificationTypes:
     (UIRemoteNotificationType)
     (UIRemoteNotificationTypeBadge | 
      UIRemoteNotificationTypeSound | 
      UIRemoteNotificationTypeAlert)];

I have also renewed my provisioning profiles, set the app up on Parse, and made sure push notifications were enabled in the portal.

This is the issue, the alert view that says whether or not I want to allow the app to enable Push Notifications never shows. I have no idea why. I am doing the exact same thing in my other app and it works fine so I am unsure why this isn't working.

Does anyone have any ideas?

Turns out that my provisioning profiles in my Organizer were not updating from the portal for some odd reason. I had to logout and log back in. Then I refreshed it and everything worked.

Another thing I checked is if my provisioning profile had something called: aps-environment or something similar to that and it didn't so thats what lead me to believe it wasn't my code that was wrong.

That alert will only show once. If you want to get it to show again Apple recommends uninstalling your app and leaving N hours before installing the app again. I can't remember what N is off the top of my head but I am pretty sure it is 24 hours.

This was really puzzling until I noticed it did work on an install to an older device running ios6. After looking around I found: registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later and that solved my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM