var country = ""
if placemark.country != nil{
country = placemark.country!
}
self.awareLocationDetaile.text = country
Try schätzen diesen Code guard Anweisung zu konvertierenguard Anweisung Variable geben Sie nicht mir
guard let country = placemark.country else{
return
}
self.awareLocationDetaile.text = country
aber unglückliche Land keinen Wert haben, wenn ich Wache verwenden Aussage, wo wenn mir Wert. Was vermisse ich ?
UPDATE:
CLGeocoder().reverseGeocodeLocation(location) { (clPlacemark :[CLPlacemark]?,error : NSError?) in
if error != nil {
print(error)
}else{
if let placemark = clPlacemark?[0]{
// print(placemark)
//MARK:- we are a good programmer
// var country = ""
// if placemark.country != nil{
// country = placemark.country!
// }
// self.awareLocationDetaile.text = country
guard let country = placemark.country else{
return
}
self.awareLocationDetaile.text = country
}
}
}
@pedrouan Bitte überprüfen Sie meine Update-Abschnitt –
Versuchen Sie eine Antwort unten. – pedrouan
@pedrouan dieser Fehler werfen: - von der Zeichenfolge downcast? nur die Optionale auspacken; Wolltest du '!' . was soll ich machen ? –