nsdictionaryを使用して日付を保存しています。テストケースから特定の日付を取得し、辞書から日付を取得しようとしています。私の辞書は10個の日付を持っています。日付を取得し、辞書から3つの日付だけを取得します。私はそれを行うことができません。誰も私はそれを行うことができますか?私は3つの日付を取得しようとも私はすべての10の日付を取得しています。 ([DD1 laterDate:たstartDate] || [DD1 isEqualToDate:たstartDate])& & ([DD1 earlierDate:endDateに] || [DD1 isEqualToDate:endDateに])){
([たstartDate earlierDate:DD1]もし& & [endDate earlierDate:dd1])nsdictionaryから日付を取得して一致させる
{
//dd==startDate;
NSManagedObject *allnew = Nil;
NSManagedObjectContext *allone=[self managedObjectContext];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Weather" inManagedObjectContext:allone];
NSLog(@" The NEW ENTITY IS ALLOCATED AS entity is %@",entity);
WeatherXMLParser *delegate = [[WeatherXMLParser alloc] initWithCity:city state:state country:country];
NSXMLParser *locationParser = [[NSXMLParser alloc] initWithContentsOfURL:delegate.url];
[locationParser setDelegate:delegate];
[locationParser setShouldResolveExternalEntities:YES];
[locationParser parse];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:entity];
predicate = [NSPredicate predicateWithFormat:
@"city == %@ and state == %@ and country == %@ and date==%@ and date==%@", city, state, country,startDate,endDate];
[request setPredicate:predicate];
NSError *err;
NSUInteger count = [allone countForFetchRequest:request error:&err];
NSLog(@" minimum salary is %@",predicate);
// If a predicate was passed, pass it to the query
if(predicate !=NULL){
//[self deleteobject];
}
Weather *weather = (Weather *)[NSEntityDescription insertNewObjectForEntityForName:@"Weather"
inManagedObjectContext:self.managedObjectContext];
weather.date = [fields objectForKey:@"date"];
weather.high =[fields objectForKey:@"high"];
weather.low = [fields objectForKey:@"low"];
weather.city =[fields objectForKey:@"city"];
weather.state =[fields objectForKey:@"state"];
weather.country =[fields objectForKey:@"country"];
NSString*icon=[fields objectForKey:@"icon"];
NSString *all=[icon lastPathComponent];
weather.condition = all;
[self saveContext];
私は2日付を取得したいが、私はnsdictionary.Iからのすべての4つの要素は、テストケースから私のSTARTDATEと終了日を渡していると私はnsxmlparserを使用して、Googleの天気予報APIから日付を取得し、NSDictionaryの中でそれらを格納しています取得しています。私は最初の日付を取得し、各日付をインクリメントし、それらを格納しています。私のNSdictionaryは怪しげに見える{ 都市=#; 条件= "ほとんど晴れ"; 国=#; date = "2011-08-11 05:00:00 +0000"; "day_of_week" = Thu; 高= 81; icon = "/ig/images/weather/mostly_sunny.gif"; 低= 65; startdate = "2011-08-11 05:00:00 +0000"; state =#;私はちょうどあなたの一例を与えている
あなたが試したことのいくつかのコードを投稿することができます。どのようにこれらに一致しようとしているのに興味がありますか? – Joe
私はお手伝いしたいと思います。しかし、あなたがしたいことを理解することは本当に難しいです。もう少し情報を提供できますか、できればいくつかのコードを提供できますか? – RickiG
よく、heres私のコード – iph