gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 11:30:02 24 4
gpt4 key购买 nike

我将我的应用程序提交到应用程序商店,他们说应用程序启动时崩溃。但对于我的设备和模拟器,它工作正常。无法在此处找到问题所在。

我附上了苹果给我的带有崩溃文件的二进制图像。请让我知道任何能够解决问题的人。

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

这次崩溃可能是什么问题?坐标 - 纬度、经度未通过或问题出在 func getAdressName(coords: CLLocation)

最佳答案

将您的 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! 的值,这可能是 nil 的情况。

关于ios - 线程 0 因 ARM 线程状态(64 位)而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54427407/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com