У меня проблема с моим приложением при тестировании на моем iphone. У меня есть метод, который сочетает в себе четыре изображения в одном и сохраняет его в библиотеке фотографий:Приложение для iPhone падает при сохранении изображения в библиотеке
- (UIImage *)combineImages{
UIImage *image1 = firstImgView.image;
UIImage *image2 = secondImgView.image;
UIImage *image3 = thirdImgView.image;
UIImage *image4 = fourthImgView.image;
UIGraphicsBeginImageContext(image1.size);
[image1 drawInRect:CGRectMake(0, 0, image1.size.width, image1.size.height)];
[image2 drawInRect:CGRectMake(0, 0, image2.size.width, image2.size.height)];
[image3 drawInRect:CGRectMake(0, 0, image3.size.width, image3.size.height)];
[image4 drawInRect:CGRectMake(0, 0, image4.size.width, image4.size.height)];
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultingImage;
}
//save actual design in photo library
- (void)savePicture{
UIImage *myImage = [self combineImages];
UIImageWriteToSavedPhotosAlbum(myImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), self);
}
//feedback if picture saving was successfull
- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {
NSString *message;
NSString *title;
if (!error) {
title = NSLocalizedString(@"Image saved", @"");
// message = NSLocalizedString(@"Your image was saved", @"");
} else {
title = NSLocalizedString(@"Error", @"");
message = [error description];
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Ok", @"")
otherButtonTitles:nil];
[alert show];
[alert release];
}
Когда я хочу, чтобы проверить его я получаю следующее сообщение об ошибке:
Program received signal: “EXC_BAD_ACCESS”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)
warning: Cancelling call - objc code on the current thread's stack makes this unsafe.
В тренажере это работает хорошо.
Фотографии все 320x460. – Crazer