CoreLocation不适用于iOS 8上的Adhoc Distribution

时间:2014-10-06 01:48:27

标签: ios xcode swift core-location testflight

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

细节:

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

1 个答案:

答案 0 :(得分: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)
    }
}

此更新解决了您的问题。