これがまったく初心者の質問である場合は申し訳ありませんが、ドキュメントまたは他のスタックの質問からこれを理解することはできません-
NSDate オブジェクトを 10:00AM GMT に設定するにはどうすればよいですか? 私が尋ねる理由は次のとおりです。ローカル通知を毎日午前 10:00 GMT に発生するように設定したいのです。
以下は正しい軌道に乗っていると思います。
NSDateComponents *comps = [[NSDateComponents alloc]init];
[comps setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
[comps setYear:2011];
[comps setMonth:1];
[comps setWeek:1];
[comps setDay:1];
[comps setHour:10];
[comps setMinute:52];
[comps setSecond:0];
NSCalendar *gregorian = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *date = [gregorian dateFromComponents:comps];
[comps release];
UILocalNotification *notif = [[UILocalNotification alloc]init];
notif.fireDate = date;
notif.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
notif.alertBody = @"New Challenges are available in Halo: Reach.\n\n Give them a look over with Halo Reach Challenges!";
notif.alertAction = @"Show Me";
notif.applicationIconBadgeNumber = 5;
notif.repeatInterval = NSDayCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
[notif release];
残念ながら、これは発火しません。どんな助けでも大歓迎です:)