我的應用程序在我的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 2010-09-10 06:50:54