2011-07-14 18 views
0

コアデータストアに文字列の最後の部分を挿入しようとしています。私はNSXMLParserを使用して文字列を取得していますが、文字列の最後の部分は挿入されません。最後の文字列がコアデータに挿入されない

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"]; 

     } 
+0

高、低、状態、または状態のうち、「newNote」キー名が設定されていませんか? – TechZen

+0

'fields'ディクショナリは実際に' string'キーを持っているのですか? – TechZen

答えて

2

あなたのコードの抜粋は、私たちは、問題が何であるかを判断するためにはあまりにも短いですが、[fields objectForKey:][fields valueForKey:]リング警鐘のあなたのミキシング。

関連する問題