Извините, если это абсолютный вопрос новичка, но я не могу понять его из документации или других вопросов о стеке -
Как я могу установить объект NSDate в 10:00 по Гринвичу?Причина, по которой я спрашиваю, заключается в следующем: я хочу, чтобы локальное уведомление происходило каждый день в 10:00 по Гринвичу.
Я думаю, что на правильном пути следующее:
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];
К сожалению, это не срабатывает.Любая помощь будет принята с благодарностью:)