Хорошо, вот мой код
-(IBAction)nextAction
{
dispatch_async(myQueue, ^{ [self plusOneDate]; });
}
-(void)plusOneDate
{
int hoursToAdd = 1;
// set up date components
NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease];
[components setHour:hoursToAdd];
// create a calendar
NSCalendar *gregorian = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
NSDate *newDate2 = [gregorian dateByAddingComponents:components toDate:appStateDate options:0];
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"YYYYMMddHH0000"];
dateString = [formatter stringFromDate:newDate2];
[formatter release];
appStateDate = newDate2;
newDate2 = nil;
}
Все, что он делает, это добавляет 1 час к объекту NSDate (appStateDate), форматирует его и устанавливает переменную dateString.
Каждый раз, когда я нажимаю кнопку UIB в приложении, подключенном к nextAction
, приложение вылетает.
Я попытался удалить файл xib и создать новый. Это не помогло и до сих пор вылетает.
В режиме отладки:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '(null): unrecognized selector sent to class 0x6242690'
Кто-нибудь, кто знает почему? Я расстраиваюсь.