I developed a project that shows an error:
'UIPopoverController' is deprecated: first deprecated in iOS 9.0 - UIPopoverController is deprecated. Popovers are now implemented as presentations of the UIViewController. Use the modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController.
My encodings:
ViewController.h:
ViewController.m:
- (void)openGallery { UIImagePickerController *Picker=[[UIImagePickerController alloc] init]; Picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary; Picker.mediaTypes=[[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil]; Picker.delegate=self; if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { UIPopoverController *popController=[[UIPopoverController alloc] initWithContentViewController:Picker]; [popController presentPopoverFromRect:CGRectMake(0, 600, 160, 300) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; self.popOver=popController; } else { [self presentViewController:Picker animated:YES completion:nil]; } } #pragma mark - UIImagePickerControllerDelegate - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { if (self.studentView) { self.videoURL = info[UIImagePickerControllerMediaURL]; [picker dismissViewControllerAnimated:YES completion:NULL]; [[NSUserDefaults standardUserDefaults] setObject:[self.videoURL absoluteString] forKey:@"url1"]; } }
I could not reference UiModalPresentationPopover correctly. Can someone help me solve this error. Any help is much appreciated. Thanks.
source share