位置情報の更新を受け取りたいです。ヘッダーに場所のデリゲートを追加しました。
@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
呼び出されません (シミュレーターとデバイスで同じ問題)。私は何が欠けていますか?
前もって感謝します、
ルダ