iphone - didUpdateToLocation is not called -
i want receive location updates. have added location delegate header:
@interface appdelegate : uiresponder <uiapplicationdelegate, cllocationmanagerdelegate>
and following functions:
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { //initialize location manager cllocationmanager* locationmanager = [[cllocationmanager alloc] init]; locationmanager.delegate = self; // [locationmanager startmonitoringsignificantlocationchanges]; [locationmanager startupdatinglocation]; self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"someviewcontroller" bundle:nil]; self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; return yes; } - (void)locationmanager:(cllocationmanager *)manager didfailwitherror:(nserror *)error{ //some problem } - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation{ //some action } but neither didupdatetolocation nor didfailwitherror called (same problem on simulator , on device). missing?
thanks in advance,
luda
are location services application enabled?
p.s: make location manager instance variable retained arc after method - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions completed.
Comments
Post a Comment