IOS Development--version adaptation OC & Project development system adaptation issues (about the background)

Source: Internet
Author: User

System adaptation of project development

About the background

In the previous iOS development, we had a wonderful experience with app adaptation issues, screen adaptation, system adaptation, but since the launch of Apple's new device (iphone 6/6p) technology (Sizeclass) is very simple to adapt to the screen, and before about the app in the system is still relatively many, Probably because of the big reform of iOS7, the IOS7 box iOS8 above the API is not much different, so about the system adaptation, we did not consider too much.

However, as a qualified developer, regardless of the actual project development, or usually we have to pay attention to the system of video, after all, iOS9 out again, although the common API changes are not very large.

So here's about IOS7/IOS8/IOS9 a system adaptation code when using the background.

1          //whether IOS 8 is judged2 3             if(Isios (8.0)) {4 5                 //get info.plist file information6 7Nsdictionary *dic =[[NSBundle Mainbundle] infodictionary];8 9[DiC enumeratekeysandobjectsusingblock:^ (IDKeyIDobj, BOOL *stop) {Ten  One //NSLog (@ "%@---%@", key, obj); A  -                 }]; -  the                 //get front and rear positioning description -  -NSString *alwaysstr = [dic valueforkey:@"nslocationalwaysusagedescription"]; -  +                 //get the foreground locator description -  +NSString *wheninusestr = [dic valueforkey:@"nslocationwheninuseusagedescription"]; A  at  -  -                 if([Alwaysstr length] >0) -  -                 { -  in[_locationm requestalwaysauthorization];//Permanent License -  to                 } +  -                 Else if([Wheninusestr length] >0) the  *                 { $ Panax Notoginseng[_locationm requestwheninuseauthorization];//Licensing in use -  the}Else +  A                 { the  +NSLog (@"To locate after iOS8.0, configure Nslocationalwaysusagedescription or nslocationwheninuseusagedescription in the Info.plist file"); -  $                 } $  -                 //Judge iOS9.0 compatible iOS9.0 background acquisition location in foreground licensing mode (blue bar appears) -  the                 if(Isios (9.0)) { - Wuyi                     //get the background pattern array the  -Nsarray *backmodes = [dic valueforkey:@"Uibackgroundmodes"]; Wu  -                     //determine if the Location update service is included in the background mode About  $                     if([Backmodes Containsobject:@" Location"]) -  -                     { -  A_locationm.allowsbackgroundlocationupdates =YES; +  the                     } -  $                 } the  the  the  the}

Finally, I hope that readers in the development of the usual attention to detail, so that your app can be more perfect!

IOS Development--version adaptation OC & Project development system adaptation issues (about the background)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.