开发者

Wait Until Current Location is set in didFinishLaunchingWithOptions

My Home UIView requires current Location coordinates and I wouldn't want it to be called until I have these coordinates. How best can I achieve this?

in this code, the view is called before the update of current location:

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

        currentLocation = [[CLLocation alloc] init];
    locationManager = [[CLLocationManage开发者_Go百科r 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"]];
        }


users can have Location service turned off. so I wouldn't do that.. Instead check for the location after the didFinishLaunchingWithOptions, so that your current problem will be solved. and add one more screen for user to turn on the location service if it's off.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜