Я совершенно сбит с толку. Мое правильно работающее приложение [на iOS <= 3.1] вылетало на iOS4. Когда я попытался отладить его, я увидел сбой в этой строке:
EDIT: Я попытался изменить положение этого оператора и поставить несколько операторов журнала для проверки, и я смог подтвердить, что приложение вылетает именно в этой строке.
Это часть моего кода:
//Various allocations here like
lblForAttachingPhoto = [[UILabel alloc]initWithFrame:CGRectMake(235, 105, 40, 20)];
lblForAttachingPhoto.backgroundColor = [UIColor grayColor];
[lblForAttachingPhoto setText:@"140"];
[lblForAttachingPhoto setTextAlignment:UITextAlignmentCenter];
btnAttachPhoto = [UIButton buttonWithType:UIButtonTypeCustom];
btnAttachPhoto.frame = CGRectMake(275, 105, 20, 20);
btnAttachPhoto.autoresizesSubviews = YES;
btnAttachPhoto.clipsToBounds = YES;
[btnAttachPhoto setImage:[UIImage imageNamed:@"arrow.jpg"] forState:UIControlStateNormal];
[btnAttachPhoto addTarget:self action:@selector(attachPhoto) forControlEvents:UIControlEventTouchUpInside];
viewForAttaching = [[UIView alloc]init];
viewForAttaching.frame = CGRectMake(5, -340, 310, 140);
for(NSInteger e=0;e<[_appDelegate.genericArray count];e++)
{
[genericArray addObject:[_appDelegate.genericArray objectAtIndex:e]];
}
for(NSInteger f=0; f< [_appDelegate.category_type count]; f++)
{
[category_type addObject:[_appDelegate.category_type objectAtIndex:f]];
}
txtVw = [[UITextView alloc]init]; //txtVw is a textview
Но, несмотря на положение оператора оператора выделения textview, это вызывает сбой приложения.
Вывод в консоль:
Program received signal: “EXC_BAD_ACCESS”.
warning: check_safe_call: could not restore current frame
warning: Unable to restore previously selected frame.
Возможно ли это? Я также реализую протокол UITextViewDelegate.
Кто-нибудь может помочь?
Заранее спасибо.