Recently developed app positioning function in the iOS8 can be normal operation, but to the iOS7 machine can not run normally, because the two systems are not the same positioning, for different systems need to do some processing. Here are some of my handling methods.
@property(nonatomic,Strong) Cllocationmanager * locmgr;-(Cllocationmanager *) locmgr{if(_locmgr = =Nil) { Self. Locmgr= [[Cllocationmanager alloc]init]; Self. Locmgr. Delegate= Self; }return_locmgr;} - (void) init{if([Cllocationmanager locationservicesenabled]) {//ios8 and above need to be set, pop-up is allowed to use location hints if(Ios8_or_later) { [ Self. LocmgrRequestalwaysauthorization]; } [ Self. LocmgrStartupdatinglocation]; Self. Locmgr. Distancefilter= Kcldistancefilternone; Self. Locmgr. Desiredaccuracy=kcllocationaccuracybestfornavigation; }Else{//Alert the user to open the positioning switchUialertview * alert = [[Uialertview alloc]initwithtitle:@"Prompt?" "message:@"Kiss!" You haven't turned on location services yet! Please go to Settings to open Location Services! "Delegate Selfcancelbuttontitle:@"Cancel"otherbuttontitles:@"OK",Nil]; [Alert show]; }}#pragma mark-cllocationmanagerdelegate- (void) Locationmanager: (Cllocationmanager *) Manager didupdatelocations: (Nsarray*) locations{the//locations array contains a Cllocation object, and a Cllocation object represents a positionCllocation *loc = [locations Firstobject];//Dimension: Loc.coordinate.latitude //Longitude: Loc.coordinate.longitude NSLog(@"Latitude =%f, longitude =%f", loc. Coordinate. Latitude, loc. Coordinate. Longitude);NSLog(@"%d", Locations. Count); Location * Loca = [[Location alloc] init]; Loca. Lat= [NSStringstringwithformat:@"%f", loc. Coordinate. Latitude]; Loca. LNG= [NSStringstringwithformat:@"%f", loc. Coordinate. Longitude]; Self. Defaultshoplistmodel. Filter. location= Loca; Self. Hotshoplistmodel. Filter. location= Loca; Self. Nearshoplistmodel. Filter. location= Loca; [ SelfUpdatedatas]; [ SelfUpdateviews];//Stop update location (if the location service does not need to be updated in real-time, you should stop updating)[ Self. LocmgrStopupdatinglocation];}
Of course, you'll need to set up some in the engineering catalog
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
iOS7 iOS8 Positioning compatibility Issue Solution