Hi all, I have a problem with my app when testing it on my iphone. I have a method that combines 4 images in one and saves it to the photo library:
- (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];
}
When I want to test it I get the following error: *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.*
In the simulator it works fine.