自从第一个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上也发生了同样的事情
  • 最佳答案

    更改此代码:

    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)
        }
    }
    

    此更新解决了您的问题。

    关于ios - CoreLocation不适用于iOS 8上的Adhoc分发,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26209086/

    10-09 10:01