Xcode6 Open the previous XCODE5 project, found that the program can not be located, including IOS8 Simulator, the real machine can not be located? Code after checking no problem, and then find Apple Ios8 Upgrade difference strategy, found that Ios8 has made some adjustments to the location processing, engineering upgrade to Xcode6 need to compileIOS8 to write their own authorization, or do not have permission to locate. The modified points are as follows:
1:Add two default fields to Info.plist and the values are set to Yes
nslocationalwaysusagedescription
nslocationwheninuseusagedescription
2: Start the Location code[Locationmanager startupdatinglocation]Before, need to increase Ios8 judgment processing
if ([[[[Uidevice Currentdevice] systemversion] doublevalue] > 8.0) {
Setting location permissions only iOS8 meaningful
[Locationmanager requestalwaysauthorization];
}
[Locationmanager startupdatinglocation];
3: Implement Cllocationmanagerdelegate Agent-(void) Locationmanagercllocationmanager *) Manager Didchangeauthorizationstatusclauthorizationstatus) Status method, note: If you do not increase the Proxy method implementation, you will not be able to eject the "program startup locator Prompt" When you first call the location to cause location failure
#pragma mark-Authorization targeting
-(void) Locationmanager: (Cllocationmanager *) Manager didchangeauthorizationstatus: (clauthorizationstatus) Status {
NSLog (@ "Call proxy");
Switch (status) {
Case kclauthorizationstatusnotdetermined:{
if ([Locationmanager respondstoselector: @selector (requestalwaysauthorization)]) {
[Locationmanager requestwheninuseauthorization];
}
}
Break
default:{
}
Break
}
}
Xcode6 open Previous project in IOS8 system unable to locate solution