【问题标题】:locationSetupControllerWithCompletion: block method is returning 'nil' ESTLocation object?locationSetupControllerWithCompletion:块方法返回“nil”ESTLocation 对象?
【发布时间】:2015-03-18 20:05:17
【问题描述】:

我正在开发 Estimote iBeacons,并尝试在 Estimote SDK 和 Indoor location SDK 的帮助下创建一个演示应用程序。我正在使用室内定位 SDK 的演示应用程序,在这个演示应用程序中,我的代码有问题:

UIViewController *nextVC = [ESTIndoorLocationManager locationSetupControllerWithCompletion:^(ESTLocation *location, NSError *error) {

        [weakSelf dismissViewControllerAnimated:YES completion:^{
            if (location)
            {
                [[NSUserDefaults standardUserDefaults] setObject:[location toDictionary] forKey:LAST_CREATED_LOCATION_KEY];

                ESTIndoorLocationViewController *navigationVC = [[ESTIndoorLocationViewController alloc] initWithLocation:location];

                [weakSelf.navigationController pushViewController:navigationVC animated:YES];
            }
        }];
    }];

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:nextVC];
    [self presentViewController:navController animated:YES completion:nil];

实际上我面临的问题是我得到 location 对象的价值是 nil 。而且我无法知道那里有什么问题。因为没有location 对象,我无法使用信标执行进一步的室内定位操作。

所以,请向我推荐任何适合此问题的解决方案。 谢谢。

【问题讨论】:

    标签: ios iphone ibeacon


    【解决方案1】:

    如果传递给完成块的location 参数是nil,那么很可能是位置设置出了问题。 error 对象中应该有详细的错误信息:

    if (location) {
        // ...
    } else {
        NSLog(@"error when setting up location: %@", error);
    }
    

    【讨论】:

      【解决方案2】:

      最后,我解决了这个问题。 实际上我并没有严格按照说明创建室内位置,所以这个方法返回 nil 位置对象。 出现此问题是因为我没有将所有信标放置在正确的位置。

      【讨论】:

      • 很高兴听到这个消息。不过,我仍然希望您得到一个错误对象,这可能是 Indoor Location SDK 中的一个错误。您可以通过 piotr[at]estimote.com 与我联系,以便我收集更多信息吗?
      猜你喜欢
      • 2014-09-26
      • 2014-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-27
      相关资源
      最近更新 更多