【问题标题】:CoreLocation not working for Adhoc Distribution on iOS 8CoreLocation 不适用于 iOS 8 上的 Adhoc 分发
【发布时间】:2014-10-06 01:48:26
【问题描述】:

自第一个 Xcode 6 beta 1 以来,我一直在开发一个依赖于 CoreLocation 的应用程序。上周我在iTunes connect/TestFlight 上提交了它进行测试。该应用程序在开发设备上完美运行,但是当我创建临时版本时,它不要求授权。

详情:

  • Settings > General > Reset > Reset Location Warnings 没解决
  • 我在 Info.plist 上设置了 NSLocationWhenInUseUsageDescription
  • CoreLocation.framework 已添加到 Linked Frameworks and Libraries(但删除后没有任何变化)
  • 我正在为 MBProgressHUD 使用 cocoapods
  • 我的 ViewController 是这样的:https://gist.github.com/thiagogabriel/d0120547565c91089b72
  • 我最近将产品名称更改为小写
  • 我从头开始了一个新项目,在 Adhoc 上也发生了同样的情况,供内部测试人员使用

【问题讨论】:

  • 我也看到了这个。到目前为止,我的想法是它可能与 TestFlight 相关。我可能会尝试 HockeyApp 或其他一些 Ad Hoc 分发设置。
  • “在开发设备上完美运行”是指它可以在开发版本上运行,甚至生产版本也可以在您在开发者计划中注册的设备上运行?
  • @MarcoPompei 当我使用电缆进行测试时它可以工作。临时案例与here 完全一样

标签: ios xcode swift core-location testflight


【解决方案1】:

更改此代码:

func askForLocation(sender: AnyObject) {
    if (locationStatus == CLAuthorizationStatus.Denied) {
        let url = NSURL.URLWithString(UIApplicationOpenSettingsURLString)
        UIApplication.sharedApplication().openURL(url)
    } else if (locationStatus != CLAuthorizationStatus.AuthorizedWhenInUse) {
        locationManager.requestWhenInUseAuthorization()
    } else if (locationStatus == CLAuthorizationStatus.AuthorizedWhenInUse){
        self.performSegueWithIdentifier("seguePlaceViewController", sender: sender)
    }
}

func askForLocation(sender: AnyObject) {
    locationManager.requestWhenInUseAuthorization()

    if (locationStatus == CLAuthorizationStatus.Denied) {
        let url = NSURL.URLWithString(UIApplicationOpenSettingsURLString)
        UIApplication.sharedApplication().openURL(url) 
    } else if (locationStatus == CLAuthorizationStatus.AuthorizedWhenInUse){
        self.performSegueWithIdentifier("seguePlaceViewController", sender: sender)
    }
}

此更新解决了您的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-20
    • 1970-01-01
    • 1970-01-01
    • 2014-11-23
    • 2016-06-25
    • 1970-01-01
    • 1970-01-01
    • 2015-10-06
    相关资源
    最近更新 更多