NSDictionary* json = [NSJSONSerialization
JSONObjectWithData:responseData
options:kNilOptions
error:&error];
NSArray* users = [json objectForKey:@"Users"];
NSEnumerator* enumerator = [users objectEnumerator];
id element;
NSMutableArray *results;
Result *fetchedResults;
while(element = [enumerator nextObject]) {
// fetchedResults = [[Result alloc] init]; // i have tried commenting/uncommenting
fetchedResults.name = (NSString *)[[element objectForKey:@"User"] objectForKey:@"name"];
fetchedResults.email = (NSString *)[[element objectForKey:@"User"] objectForKey:@"name"];
NSLog(@"%@", fetchedResults.name);
[results addObject:fetchedResults];
NSLog(@"%@", (NSString *)[[element objectForKey:@"User"] objectForKey:@"name"]); // this returns valid dump
}
NSLog(@"%d", [results count]); // returns 0
ここで何が悪いのかわかりません。多数のチュートリアルとリソースを検索しましたが、ここで何が問題なのかわかりません。
編集:
NSLog(@"%@", fetchedResults.name); // dumps null