我从以下内容Array
中检索到Core Data
:
NSArray *dataArray = [context executeFetchRequest:request error:&error];
所以我编写了这段代码来分别获取每一行数据以将其发送到 REST API:
for (NSString *str in dataArray) {
NSString *name =[dataArray valueForKey:@"name"];
NSString *dob = [dataArray valueForKey:@"dob"];
int gender =[[dataArray valueForKey:@"gender"]integerValue];
NSString *childId =[dataArray valueForKey:@"id"];
int response = [network sendName:name withDateOfBirth:dob andGender:gender forID:childId];
if (response == 200) {
// [self performSelectorOnMainThread:@selector(postSuccess) withObject:nil waitUntilDone:YES];
NSLog(@"Success");
}
}
但它不起作用,因为我不知道数据是如何存储在数组中的每个索引中的!请帮忙,如果我没有正确执行此操作,请告诉我更好的方法。
谢谢。