Monday, May 21, 2012

how to solve this error of Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type 1 not available'

I have working on pick the photo from gallery and save in gallery



my code is



-(void)onclicksave:(id)sender
{
NSLog(@"onclicksave");
UIImagePickerController *picker=[[UIImagePickerController alloc]init];
picker.delegate=self;

if((UIButton *)sender== openLibrary)
{
picker.sourceType=UIImagePickerControllerSourceTypeSavedPhotosAlbum;

}
else
{
picker.sourceType=UIImagePickerControllerSourceTypeCamera;
}

[self presentModalViewController:picker animated:YES];

}

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissModalViewControllerAnimated:YES];
imagedisplay.image=[info objectForKey:@"UIImagePickerControllerOriginalImage"];

}


but in this code run time error like



Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type 1 not available'



so give any suggestion and source code which is apply in my code





No comments:

Post a Comment