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 isfunc 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
Realm + Nstableview + Nsarraycontroller
Add Assets to an Icloud Shared Photo Album Programmatically
How to Check for Self with Contains() in Swift
Avoid Equatable and Hashable Boilerplate, Swift 4.2
Pass Data from Tableviewcontroller to Another Tableviewcontroller in Swift
Populate a Multidimensional Array with a Loop
How Pass Data from Button in Tableviewcell to View Controller
Issues with Uploading from Xcode 9 to App Store/ Itunes Connect
Display Array in a Label in Swift
Hit Fatal Error: Unexpectedly Found Nil While Unwrapping an Optional Value (Lldb)
Prefix(_ Maxlength:) Is Type-Erased When Used with a Struct That Conforms to Lazysequenceprotocol
A Warning "'Init()' Is Deprecated". [Swift, iOS App, Learning Model]
Is There an Object Class in Swift
How to Run Terminal Command in Swift from Any Directory
It Is Posible to Load Customise HTML View into Webview in Swift
How to Download Datas from Multiple Url in Concurrency Mode
Wkwebview on Macos Cuts Off Top
Swiftui Tabview with List Not Refreshing After Objected Deleted From/Added to Core Data