我希望收到位置更新。 我添加了一个位置代表对标题:
@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
被称为(设备上的仿真器和上同样的问题)。 我在想什么?
提前致谢,
Luda