1. Positioning
Locate using the Corelocation library and introduce corelocation/corelocation. Create the Cllocationmanager object and use the Startupdatinglocation method to start updating location information.
_mgr = [[Cllocationmanager alloc] init];[ _mgr requestwheninuseauthorization];_mgr. delegate = self;[ _mgr Startupdatinglocation];
After the update succeeds, the Cllocationmanagerdelegate proxy method is called
-(void) Locationmanager: (Cllocationmanager *) Manager didupdatelocations: (Nsarray *) locations{ 1]; NSLog (@ "%f,%f\n", Location.coordinate.latitude, location.coordinate.longitude);}
If you want to stop the update, call stopupdatinglocation.
PS1: If you are prompted to open the location at startup, you need to call the requestwheninuseauthorization of the Cllocationmanager object .
PS2: Tips for targeting purposes, adding nslocationwheninuseusagedescription, nslocationalwaysusagedescription add hints in Info.plist
iOS maps and location using