lakshmen
lakshmen

Reputation: 29084

Choosing From Library using UIImagePickerControllerSourceTypeSavedPhotosAlbum

I would like to have choosing images or videos as one option when taking photos or videos. When i seem to click the option, the app crashes. I am using ios 6 and it seems that apple has included some privacy issues when the app tries to search for existing images and videos. Besides that, should i still be using UIImagePickerControllerSourceTypeSavedPhotosAlbum or use something else?

Part of my code:

 if (buttonIndex == 2) { 
        imgpPicker           = [[UIImagePickerController alloc] init];
        imgpPicker.sourceType  = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
        imgpPicker.mediaTypes  = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie,(NSString *)kUTTypeImage,nil];
        popOverView             = [[UIPopoverController alloc] initWithContentViewController:imgpPicker];
        [popOverView presentPopoverFromRect:self.view.bounds inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

}

The error that appears on the debugger is signal SIGABRT:

*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

*** First throw call stack:
(0x36a732a3 0x33e9a97f 0x36a731c5 0x3777d897 0x3777d6a1 0x3777d65b 0x3777ce1b 0x3777cb45 0x37735767 0x377355c7 0x377355c7 0x3772fe53 0x377177e5 0x377172cb 0x37b00b95 0x115313 0x378d6ccb 0x378000ad 0x3780005f 0x3780003d 0x377ff8f3 0x377ffde9 0x377285f9 0x37715809 0x37715123 0x3644d5a3 0x3644d1d3 0x36a48173 0x36a48117 0x36a46f99 0x369b9ebd 0x369b9d49 0x3644c2eb 0x37769301 0xe1763 0xe14c0)
libc++abi.dylib: terminate called throwing an exception
(lldb) 

The privacy for the application is also set to ON in the settings.

Am i doing something wrong?

Any guidance or tips will be very helpful. Sorry if the question is very vague.. If need more information, I can provide...

Upvotes: 1

Views: 544

Answers (1)

Midhun MP
Midhun MP

Reputation: 107171

In your code add:

- (BOOL)shouldAutorotate
{
   return YES;
}

And go to the summary tab of your application and allow both portrait and landscape orientations.

Summary Tab

Upvotes: 1

Related Questions