Ich bin mit IOS10 auf meine App-Kompatibilität zu arbeiten und ich habe ein Problem, wenn die Ausführung dieses Code:IOS 10 objectForKey („Schlüssel“) Kompatibilität
if let results = NSJSONSerialization.TryJSONObjectWithData(data, options: []) as? NSDictionary {
print(" results : \(results)");
if let networkPosts = results["results"] as? NSMutableArray {
print(" here");
for i in 0 ..< networkPosts.count {
let post:Post = Post(postDictionary: networkPosts[i] as! NSDictionary, context: (UIApplication.sharedApplication().delegate as!
AppDelegate).coreDataHelper.managedObjectContext);
}
}
}
ich die Ergebnisse sehen kann, so dass die JSON in Ordnung ist, aber nachdem ich den Ergebnisschlüssel des Wörterbuchs nicht sehen kann. "Hier" wird nie auf meiner Konsole gedruckt. Ich habe versucht, einen Haltepunkt zu machen und es passiert auch nicht dort. Ich habe auch versucht mit .objectForKey("key")
aber das gleiche Ergebnis:/
Kann mir bitte jemand helfen?
Wenn ich results["results"] as? [[String: Any]]
Dann
networkPosts [i] wie! NSDictionary nicht immer
Post JSON, dass Sie erhalten –
Bitte zeigen Sie uns Ihre json Antwort. –
Haben Sie 'Ergebnisse' Schlüssel in Ihrem JSON? oder ist es "Ergebnis"? – Santosh