0
我试图在Core数据存储中插入字符串的最后一部分。我正在使用NSXMLParser
获取字符串,但字符串的最后部分未被插入。字符串的最后部分没有插入到coredata
for (NSMutableDictionary *fields in [delegate forecastConditions]) {
// NSLog(@"got %@", fields);
NSNumber*high=[fields objectForKey:@"high"];
NSLog(@"the high is %@",high);
NSManagedObjectContext *new=[self managedObjectContext];
NSManagedObject *newNote;
newNote=[NSEntityDescription insertNewObjectForEntityForName:@"Weather" inManagedObjectContext:new];
[newNote setValue:[fields valueForKey:@"high"] forKey:@"high"];
NSNumber *low=[fields objectForKey:@"low"];
NSLog(@"the low is %@",low);
[newNote setValue:[fields valueForKey:@"low"] forKey:@"low"];
NSString*icon=[fields objectForKey:@"icon"];
NSString *all=[icon lastPathComponent];
NSLog(@" the icon is %@",all);
[newNote setValue:[fields valueForKey:@"all"] forKey:@"condition"];
NSString *string=[fields objectForKey:@"condition"];
NSLog(@"the condition is %@",string);
[newNote setValue:[fields valueForKey:@"string"] forKey:@"state"];
}
什么'newNote'键名出高,低,条件或状态,没有被设置? – TechZen
'fields'字典实际上是否有'字符串'键或是一个错字? – TechZen