Keep Getting an Error: "Uiimagepickercontroller Extension Discovery Failed with Error: (Null)"

UIImagePickerController extension discovery failed with error: (null)

I checked the details, and there are no issues in your implementation.
I also checked the apple's official sample here.
https://developer.apple.com/documentation/uikit/uiimagepickercontroller/customizing_an_image_picker_controller
Same result!

Finally, this is an issue related to iOS Simulators(version 11.3.1).
FYI, I found iPhone 11 Pro Max didn't work in some previous versions, but iPhone 8 and some others worked.
I just want you guys not wasting time on this. Move ahead.

Thanks.

Swift 4 errors encountered while discovering extensions - photo will not load on UI

Two issues:

  • The signature of didFinishPickingMediaWithInfo is wrong. In Swift 3+ it is

    func imagePickerController(_ picker: UIImagePickerController, 
    didFinishPickingMediaWithInfo info: [String : Any])
  • The delegate method must be on the top level of the class (not in another method)

    @IBAction func edit_click(_ sender: Any) {

    //select ava
    let picker = UIImagePickerController()
    picker.delegate = self
    picker.sourceType = .photoLibrary
    picker.allowsEditing = true
    self.present(picker, animated: true, completion: nil)
    }

    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

    //selected image
    let image = info[UIImagePickerControllerEditedImage] as? UIImage
    avaImg.image = image
    self.dismiss(animated: true, completion: nil)
    }

Xamarin Forms iOS UIImagePickerController not shown when called from a modal page (formsheet)

Thanks to @Cheesebaron I could fix the problem.
This is working on my end.

public Task<Stream> GetImageStreamAsync()
{
// Create and define UIImagePickerController
imagePicker = new UIImagePickerController
{
SourceType = UIImagePickerControllerSourceType.PhotoLibrary,
MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary),
//ModalPresentationStyle = UIModalPresentationStyle.FormSheet,
};

// Set event handlers
imagePicker.FinishedPickingMedia += OnImagePickerFinishedPickingMedia;
imagePicker.Canceled += OnImagePickerCancelled;

// Present UIImagePickerController;
UIViewController currentController = UIApplication.SharedApplication.KeyWindow.RootViewController;
while (currentController.PresentedViewController != null)
currentController = currentController.PresentedViewController;

currentController.PresentViewController(imagePicker, true, null);

// Return Task object
taskCompletionSource = new TaskCompletionSource<Stream>();
return taskCompletionSource.Task;
}

Thanks for helping out!



Related Topics



Leave a reply



Submit