我想接收位置更新。 我添加了一個位置代表對標題:didUpdateToLocation不叫
@interface AppDelegate : UIResponder <UIApplicationDelegate, CLLocationManagerDelegate>
和以下功能:
- (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
}
但無論是didUpdateToLocation
也不didFailWithError
被稱爲(在模擬器上和設備上的相同的問題) 。我錯過了什麼?
由於提前,
旅大
這是ARC在進程中間發佈ur變量時的可能情況,因此沒有任何代表被調用。 – samfisher
我想這就是我的意思是我的P.S. ;-) – Jake
謝謝你們兩位! – Luda