Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work on iPad #8

Closed
agugel opened this issue May 22, 2018 · 3 comments
Closed

Does not work on iPad #8

agugel opened this issue May 22, 2018 · 3 comments

Comments

@agugel
Copy link

agugel commented May 22, 2018

The alert view can't be presented on an iPad, when style = .actionSheet is used.

*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x105272a00>) of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. 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.'
*** First throw call stack:

@kiliankoe
Copy link
Owner

kiliankoe commented May 22, 2018

Huh, you're absolutely right. Seems like I've never tested this to run on an iPad 🤦‍♂️

Since I don't want to make any assumptions about your presentation, I just pushed a new commit that adds Karte.createPicker() which returns the UIAlertController instead of directly trying to present it. Can you try and see if that works out for you including the notes referred to here? Thanks!

If it works for you I'll gladly bump the version to 0.2.0 with those changes.

@agugel
Copy link
Author

agugel commented May 23, 2018

Hi Kilian,

Thank you very much! This new method Karte.createPicker() works great on iPad and iPhone

`
let sender : UIButton....

let alertController = Karte.createPicker(destination: location)
if let popoverController = alertController.popoverPresentationController {
popoverController.sourceView = sender
popoverController.sourceRect = sender.bounds
}
self.present(alertController, animated: true)`

Thanks for your fast response and excellent work.

Alex

@kiliankoe
Copy link
Owner

Thanks for the update! Just tagged the version and pushed 0.2.0 accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants