Blog post to Http://blog.csdn.net/cerastes/article/details/39546625ios8push push notification adaptation
iOS8 Push Issues
Registerforremotenotificationtypes:is not supported in IOS 8.0 and later.
[OBJC]View Plaincopy
- if ([[[[Uidevice Currentdevice] systemversion] Floatvalue] >= 8. 0)
- {
- [[UIApplication sharedapplication] registerusernotificationsettings:[uiusernotificationsettings
- settingsfortypes: (Uiusernotificationtypesound | Uiusernotificationtypealert | Uiusernotificationtypebadge)
- Categories: nil]];
- [[UIApplication sharedapplication] registerforremotenotifications];
- }
- Else
- {
- This is still the original code.
- [[UIApplication sharedapplication] registerforremotenotificationtypes:
- (Uiusernotificationtypebadge | Uiusernotificationtypesound | Uiusernotificationtypealert)];
- }
Determine if push is open
[OBJC]View Plaincopy
- {
- Uiremotenotificationtype types;
- if ([[[[Uidevice Currentdevice] systemversion] Floatvalue] >= 8. 0)
- {
- types = [[UIApplication sharedapplication] currentusernotificationsettings]. Types;
- }
- Else
- {
- types = [[UIApplication sharedapplication] enabledremotenotificationtypes];
- }
- Return (types & Uiremotenotificationtypealert);
- }
iOS8 Push Issues