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

Crash on iPad #23

Open
julianpomper opened this issue Sep 6, 2018 · 5 comments
Open

Crash on iPad #23

julianpomper opened this issue Sep 6, 2018 · 5 comments

Comments

@julianpomper
Copy link

It´s me again 😃 Todays issue: When presenting the picker on an iPad, the app crashes with this error:

Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x7fe137a00600>) 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.'

and a for every available app this log before it crahes:
-canOpenURL: failed for URL: "moovit://" - error: "Der Vorgang konnte nicht abgeschlossen werden. (OSStatus-Fehler -10814.)"

@kiliankoe
Copy link
Owner

kiliankoe commented Sep 6, 2018

The first part is the same as #8. presentPicker will not work directly on iPad, please use createPicker instead and handle the presentation manually.

Regarding the second issue, I'm not quite sure about the error code 😕 Could it be that you might be missing the Info.plist strings to query for the apps?

@julianpomper
Copy link
Author

Yes first part was the same. Thank you!

The second one is no issue, i just thought it might be helpful. Everything works fine but as I present the picker, these logs appear in the console. Just wanted you to know that. 👍

@kiliankoe
Copy link
Owner

Did you add the URLs to your app's Info.plist though as the README suggests? Maybe the apps shown in the logs are missing there? That's my only guess currently where that message could be coming from 🙈

@julianpomper
Copy link
Author

Yes they are there

@seljabali
Copy link

seljabali commented Oct 4, 2019

Confirmed bug. Running into the same issue on iPad with project setup properly with Info.plist added.

Fix is straight forward:

let picker: UIAlertController = Karte.createPicker(destination: someLocation)
if let popoverPresentationController = picker.popoverPresentationController {
    popoverPresentationController.sourceView = self.view
    popoverPresentationController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)
    popoverPresentationController.permittedArrowDirections = []
}
present(picker, animated: true)

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

3 participants