ios - Conditional comment tags in Objective-c -
sorry if seems stupid question:
i have phonegap app building ios8, issue ios8 deprecated code pus notifications, in ios8 have gotten them work code utilize work doesnt work in ios7, im trying work both. im using if else statement check version fine issue though if else fires right version of code, in ios7 app wont compile correctly because sees newer code doesnt exist in ios7 sdk, there way can create work? how can coniditional comments in html specific browser versions?
this have, see if else statement, not work on ios7 sdk sdk doesnt know code in initial (if) since new in ios8
nsarray *vcomp = [[uidevice currentdevice].systemversion componentsseparatedbystring:@"."]; if ([[vcomp objectatindex:0] intvalue] >= 8) { /// first register notification setting settings type [[uiapplication sharedapplication] registerusernotificationsettings:[uiusernotificationsettings settingsfortypes:(uiremotenotificationtypesound | uiremotenotificationtypealert | uiremotenotificationtypebadge) categories:nil]]; [[uiapplication sharedapplication] registerforremotenotifications]; // can set here local notification. } else if ([[vcomp objectatindex:0] intvalue] < 8) { [[uiapplication sharedapplication] registerforremotenotificationtypes:notificationtypes]; }
#if __iphone_os_version_max_allowed >= 80000 //put ios 8 code here #else // set ios 7 , below here #endif
ios objective-c cordova
No comments:
Post a Comment