等待直到当前位置在didFinishLaunchingWithOptions中设置

时间:2011-01-21 16:21:07

标签: iphone core-location uiapplicationdelegate

My Home UIView需要当前的位置坐标,我不希望它被调用,直到我有这些坐标。我怎样才能做到最好?

在此代码中,视图在更新当前位置之前调用:

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        currentLocation = [[CLLocation alloc] init];
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    [locationManager startUpdatingLocation];

TTNavigator *navigator = [TTNavigator navigator];
            navigator.persistenceMode = TTNavigatorPersistenceModeAll;
            TTURLMap *map = navigator.URLMap;

            [map from:@"tt://HomeView" toViewController:  viewController];
            [navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://HomeView"]];
        }

1 个答案:

答案 0 :(得分:0)

用户可以关闭位置服务。所以我不会这样做.. 而是检查didFinishLaunchingWithOptions之后的位置,以便解决当前问题。 并添加一个屏幕供用户打开位置服务,如果它关闭。