In this post, we will see how to resolve How to show “HSAttachmentPicker” in iPad in swift
Question:
I need to upload images and pdf files so i am using HSAttachmentPicker framework with this i am able to open picker options and able to upload image and pdf in iPhone but its crashing in iPad when i click upload buttonerror:
You must provide location information for this popover through the alert controller’s popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.’
but
HSAttachmentPicker
is a framework so where should i add code for iPadcode: this is the code i have written in my upload image class
showAttachmentMenu
in HSAttachmentPicker framework file: here where to add code for iPad.. please guide.Best Answer:
It would be a good idea to read-up onpopover
presentation: DocsIf you look at the view controller in the example provided with HSAttachmentPicker, you’ll see how the example app handles it. Yes, it’s in Objective-C … but it’s almost identical in Swift:
If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com
Leave a Review