This article reprinted to http://bbs.csdn.net/topics/390889517
IOS8 Push Solution
Last night to organize push things, prepare a tutorial, all finished, found not to achieve the expected effect, this thought is the server code problem (because I do not understand PHP code), so search around the internet, and then see the Xcode log found that, It turned out to be an issue with the IOS8 system update, prompting Registerforremotenotificationtypes:is not supported in IOS 8.0 and later.
Students using IOS8 Xcode6 should already have this problem when using push. So let's take a look at the specific solution.
IOS 8 have changed notification registration in a non-backwards compatible the. While your need to support IOS 7 and 8 (and while apps built with the 8 SDK aren ' t accepted), you can check for the Selecto RS need and conditionally call them correctly for the running version.
Here's a category on uiapplication that'll hide this logic behind a clean interface for you that'll work in both Xcode 5 and Xcode 6.
IOS8 new system requires the use of new code
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)];
}
The method used to determine whether push is open in IOS7 is:
Uiremotenotificationtype types = [[UIApplication sharedapplication] enabledremotenotificationtypes];
Return (types & Uiremotenotificationtypealert);
If this code is used in iOS, although there will be no crash phenomenon, but basically no effect.
In IOS8, we use the following new code to replace the above code
{
Uiremotenotificationtype types;
if ([[[Uidevice Currentdevice] systemversion] floatvalue] >= 8.0)
{
types = [[UIApplication sharedapplication] currentusernotificationsettings].types;
}
Else
{
types = [[UIApplication sharedapplication] enabledremotenotificationtypes];
}
Return (types & Uiremotenotificationtypealert);
}
Every time Apple updates a new version of the time, the most painful is our group of Dick Silk AH
Refueling yards Farm!
This article transfer from http://www.999dh.net/home.php?mod=space&uid=1&do=blog&quickforward=1&id=419 reprint please specify!!
Registerforremotenotificationtypes:is not supported in IOS 8.0 and later