ich JSON neu bin und wie diese in einer Schleife durch meine JSON Array versuchtIOS JSON - Getting unerwartete Ergebnisse in der Konsole
for (NSDictionary *dict in self.contentArray) {
NSLog(@"%@", dict);
}
Aber halten diese Art von Inhalten bekommen statt des tatsächlichen Wörterbuch in der Konsole :
<Content: 0x7fd9b1037950>
Hier ist mein Code, dass ich das Array verwendet, um:
// Create a new array to hold the locations
NSMutableArray *locations = [[NSMutableArray alloc] init];
// Get an array of dictionaries with the key "locations"
NSArray *array = [jsonDictionary objectForKey:@"data"];
// Iterate through the array of dictionaries
for(NSDictionary *dict in array) {
// Create a new Location object for each one and initialise it with information in the dictionary
Content *content = [[Content alloc] initWithJSONDictionary:dict];
// Add the Location object to the array
[locations addObject: content];
}
Weil das ist, was tatsächlich in Ihrem Array ist. Wie erstellen Sie das Array? – dan
Bearbeiten Sie den Code in Ihre Frage, damit er lesbar ist. – dan
Und Sie bekommen das erwartete Verhalten, was Sie sonst noch erwarten? Sie speichern ein Inhaltsobjekt und erhalten es. – ldindu