I was following this tutorial to add a simple share sheet to my SwiftUI app. It works properly on iPhones but crashes on iPad with this error:
Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<UIPopoverPresentationController: 0x107d95ee0>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
Any way to get around this error? Not exactly sure what's happening here.
isIpad
? FYI - there's no reason to only set thesourceView
andsourceRect
on an iPad. It's perfectly fine to set them for all devices. – Histamine