There seems to be something wrong with one of my if statements. Can anyone tell me why error is getting printed?
func getRecordToUpdate(_ locations:CLLocation)
{
if defaults1.object(forKey: "locationData") == nil{
defaults1.set("yes", forKey: "locationData")
}else{
print("error")
if let loadedData = UserDefaults.standard.data(forKey: "locationData") {
if (NSKeyedUnarchiver.unarchiveObject(with: loadedData) as? String) != nil
{
print("good")
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire