线程0因ARM线程状态(64位)而崩溃

时间:2019-01-29 18:24:52

标签: ios location app-store

我已将我的应用提交到应用商店,他们说应用启动时崩溃。但是对于我的设备和模拟器中的设备来说,它的工作都很好。在这里找不到什么问题。

我用苹果给我的崩溃文件附加了二进制图像。请让我知道任何有问题的人。

Here is that crash file

谢谢

enter image description here

崩溃显示在这里:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   WCi                             0x0000000100df0454 specialized closure #1 in MainScreenViewController.getAdressName(coords:) + 509012 (MainScreenViewController.swift:668)
1   WCi                             0x0000000100e01ed4 partial apply for closure #1 in MainScreenViewController.getAdressName(coords:) + 581332 (MainScreenViewController.swift:0)
2   WCi                             0x0000000100de0288 _T0SaySo11CLPlacemarkCGSgs5Error_pSgIegxx_So7NSArrayCSgSo7NSErrorCSgIeyByy_TR + 443016 (MainScreenViewController.swift:0)
3   libdispatch.dylib               0x00000001d96596c8 0x1d95f9000 + 394952
4   libdispatch.dylib               0x00000001d965a484 0x1d95f9000 + 398468
5   libdispatch.dylib               0x00000001d96069a4 0x1d95f9000 + 55716
6   CoreFoundation                  0x00000001d9bb0df4 0x1d9b05000 + 703988
7   CoreFoundation                  0x00000001d9babcbc 0x1d9b05000 + 683196
8   CoreFoundation                  0x00000001d9bab1f0 0x1d9b05000 + 680432
9   GraphicsServices                0x00000001dbe24584 0x1dbe19000 + 46468
10  UIKitCore                       0x0000000206b38c00 0x206250000 + 9341952
11  WCi                             0x0000000100dbeba4 main + 306084 (AppDelegate.swift:23)
12  libdyld.dylib                   0x00000001d966abb4 0x1d966a000 + 2996

所以在我的MainScreenViewController.swift

 func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {


        if  firstload == false  {
            firstload = true
            firstTimeLoads = true
            currentlocation = locations.last!
            let cityCoords = CLLocation(latitude: currentlocation.coordinate.latitude, longitude: currentlocation.coordinate.longitude)
            let addresss = getAdressName(coords: cityCoords)
            self.userlat =  "\(currentlocation.coordinate.latitude)"
            self.userlong = "\(currentlocation.coordinate.longitude)"
            self.userDevice = "iOS"
            self.userName = Uname ?? "NA"
            self.userId = UId ?? "NA"
            self.userTime = time


            let camera = GMSCameraPosition.init(target: currentlocation.coordinate, zoom: 11, bearing: 0, viewingAngle: 0)
            passloc = String(format: "%f,%f", currentlocation.coordinate.latitude,currentlocation.coordinate.longitude)
            if let locationData = passloc {
                self.movelocation = currentlocation
                UserDefaults.standard.set(locationData, forKey: "storemyloc")
                UserDefaults.standard.synchronize()
                viewmap.animate(to: camera)
                self.getAddressFromLatLon(location: currentlocation)
                print("my address")
                print(currentlocation)

                print("LOG: LOCATION 1 \(searchlocation)")
                if CLLocationCoordinate2DIsValid(self.searchlocation.coordinate) {
                    self.movelocation = self.searchlocation
                } else {
                    self.runlink()
                }
            }
        }
    }

func getAdressName(coords: CLLocation) {

    CLGeocoder().reverseGeocodeLocation(coords) { (placemark, error) in
        if error != nil {
            print("Hay un error")
        } else {

            let place = placemark! as [CLPlacemark]
            if place.count > 0 {
                let place = placemark![0]
                var adressString : String = ""


                if place.locality != nil {
                    adressString = adressString + place.name! + " - "
                }
                if place.thoroughfare != nil {
                    adressString = adressString + place.subLocality! + ", "
                }

                if place.locality != nil {
                    adressString = adressString + place.subAdministrativeArea! + " - "
                }

                if place.country != nil {
                    adressString = adressString + place.country!
                }
               self.Userdic.setValue(adressString, forKey: "useraddress")
                self.userAdd = adressString
            }
        }
    }
}

那次崩溃可能是什么问题?坐标-未通过lat,long或func getAdressName(coords: CLLocation)

存在问题

1 个答案:

答案 0 :(得分:1)

用下面的代码替换getAdressName

func getAdressName(coords: CLLocation) {

        CLGeocoder().reverseGeocodeLocation(coords) { (placemark, error) in
            if error != nil {
                print("Hay un error")
            } else {

                let place = placemark! as [CLPlacemark]
                if place.count > 0 {
                    let place = placemark![0]
                    var adressString : String = ""


                    if place.name != nil {
                        adressString = adressString + place.name! + " - "
                    }
                    if place.subLocality != nil {
                        adressString = adressString + place.subLocality! + ", "
                    }

                    if place.subAdministrativeArea != nil {
                        adressString = adressString + place.subAdministrativeArea! + " - "
                    }

                    if place.country != nil {
                        adressString = adressString + place.country!
                    }
                   self.Userdic.setValue(adressString, forKey: "useraddress")
                    self.userAdd = adressString
                }
            }
        }
    }

您检查locality的nil,但在内部获取place.subAdministrativeArea!的值,在零情况下可能会