iphone - CLLocationManager not returning location after temporarily disabling in settings -


i temporarily disabled location services, , permissions app, test code dealt scenario they're not available. upon turning them on again, location can't fetched, using code:

cllocationmanager *locationmanager = [[cllocationmanager alloc] init]; [locationmanager startupdatinglocation]; cllocation *currentlocation = locationmanager.location; [locationmanager stopupdatinglocation]; 

the locationmanager.location equal nil after running code.

i'm running on ipad running ios 6.

set delegate cllocationmanager

cllocationmanager *locationmanager = [[cllocationmanager alloc] init]; locationmanager.delegate = self; [locationmanager startupdatinglocation];

try delegates of cllocationmanager.

- (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation {     self.currentlocation = newlocation;             } - (void)locationmanager:(cllocationmanager *)manager didfailwitherror:(nserror *)error {     // location "unknown" error means manager unable location.     // can ignore error scenario of getting single location fix, because have     // timeout stop location manager save power.     if ([error code] != kclerrorlocationunknown) {         [self stopupdatinglocation:nslocalizedstring(@"error", @"error")];     } }

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -