I am building an app in which you can make pictures or pick an image from the camera roll and save these inside the app to be displayed in a tableview and detailview. The problem is that when I make a picture from inside the app and save it, the tableview and detailview get terribly slow as if the app is freezing. I also get this error ": CGAffineTransformInvert: singular matrix.". When I load a picture from the camera-rol that was not taken from inside my app, there is no problem and the app runs very smouthly.
This is the code for when I open the camera and camera roll:
-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{
if (buttonIndex == actionSheet.cancelButtonIndex) {
return;
}
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
switch (buttonIndex) {
case 0:
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
break;
case 1:
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]) {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
break;
}
[self presentModalViewController:picker animated:YES];
}
This is where I save it to the camera roll and put the image in an imageView:
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
UIImage *mijnImage;
if (CFStringCompare((__bridge_retained CFStringRef)mediaType, kUTTypeImage, 0)==kCFCompareEqualTo) {
mijnImage = (UIImage *) [info objectForKey:UIImagePickerControllerOriginalImage];
mijnPlaatje_.image = mijnImage;
UIImageWriteToSavedPhotosAlbum(mijnImage, nil, nil, nil);
}
[picker dismissModalViewControllerAnimated:YES];
}
And here I save the image inside my app:
-(IBAction)save:(id)sender{
drankjes.plaatje = [mijnPlaatje_ image];
[self dismissModalViewControllerAnimated:YES];
}
What am I doing wrong?
This issue could have occurred if the Camera Roll folder is not added to the Picture Library properly. I would suggest you to manually add the Camera Roll folder to Picture Library and check if it helps. a) Right-click on Picture Library. b) Click on Properties. c) Click on Add button.
If you get an error message that says your camera roll is missing (0xA00F4275) when you try to take a picture or video with the Camera app in Windows 10, try the following solutions, in the order listed. Select Start > Settings > System > Storage > Change where new content is saved.
If you get an error message that says your camera roll is missing (0xA00F4275) when you try to take a picture or video with the Camera app in Windows 10, try the following solutions, in the order listed. Change where new pictures and videos are saved Select Start > Settings > System > Storage > Change where new content is saved.
You can use TunesGo to delete unwanted photos from your iPhone, and you can post more pictures to the camera roll. Step 1 Start Wondershare TunesGo on your computer and connect your iPhone. Step 2 Backup the photos to the computer by clicking the “ Backup Photos to PC ” on the main interface.
You need to use:
UIImageWriteToSavedPhotosAlbum(image, self, @selector(video:didFinishSavingWithError:contextInfo), nil)
and implement:
- (void)image:(UIImage *) image didFinishSavingWithError: (NSError *) error contextInfo: (void *) contextInfo {
NSLog(@"Saving image");
if(error != nil) {
NSLog(@"Error saving: %@",[error localizedDescription]);
}
}
as Jensen2K says, didFinishSavingWithError
is called even if there is no error so you can use it to tell when the save has finished.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With