मैंने अपना ऐप ऐप स्टोर में जमा कर दिया, उन्होंने कहा कि ऐप लॉन्च होने पर क्रैश हो गया। लेकिन सिम्युलेटर में मेरे डिवाइस के लिए यह ठीक काम कर रहा है। यहां क्या समस्या है यह नहीं ढूंढ पा रहे हैं।
मैंने बाइनरी छवि को क्रैश फ़ाइल के साथ संलग्न किया जो सेब ने मुझे दिया था। कृपया मुझे कोई भी 1 समस्या प्राप्त करने में सक्षम बताएं।
धन्यवाद
दुर्घटना यहाँ दिखाया गया है:
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 उत्तर
अपने 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
के शून्य की जांच कर रहे हैं लेकिन अंदर place.subAdministrativeArea!
का मान प्राप्त कर रहे हैं जो शून्य मामले में हो सकता है।
संबंधित सवाल
नए सवाल
ios
iOS, Apple iPhone, iPod टच और iPad पर चलने वाला मोबाइल ऑपरेटिंग सिस्टम है। IOS प्लेटफॉर्म पर प्रोग्रामिंग से संबंधित प्रश्नों के लिए इस टैग [ios] का उपयोग करें। उन प्रोग्रामिंग भाषाओं के लिए विशिष्ट मुद्दों के लिए संबंधित टैग [उद्देश्य-सी] और [स्विफ्ट] का उपयोग करें।