I’ve been running my application on an iOS physical device for some time without any problems. But now the UIImagePickerController view will not appear on the simulator. I already saved the photos in the simulator using the method here and confirmed that they exist on the simulator in the image library. There are no errors in Xcode. And I tried to play with different types of sources, but to no avail. Any idea what I can do wrong? Thank you very much!
the code
UIImagePickerControllerSourceType sourceType;
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
else
{
sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
[self startImagePickerControllerFromViewController: self
usingDelegate: self
withSourceType: sourceType];
...
- (BOOL)startImagePickerControllerFromViewController:(UIViewController*) controller
usingDelegate:(id <UIImagePickerControllerDelegate,
UINavigationControllerDelegate>) delegate
withSourceType:(UIImagePickerControllerSourceType) sourceType
{
if (([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera] == NO)
|| (delegate == nil)
|| (controller == nil))
return NO;
UIImagePickerController *imagePickerUI = [[UIImagePickerController alloc] init];
imagePickerUI.sourceType = sourceType;
imagePickerUI.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil];
imagePickerUI.allowsEditing = NO;
imagePickerUI.delegate = delegate;
[controller presentViewController:imagePickerUI animated:YES completion:nil];
return YES;
}
source
share