stripe / stripe-ios

Stripe iOS SDK
https://stripe.com
MIT License
2.11k stars 976 forks source link

[BUG] Crash when presenting `UIPopoverPresentationController` on an iPad #2671

Open nalexn opened 1 year ago

nalexn commented 1 year ago

Summary

Stripe identity verification SDK crashes for iPads with the following message:

NSGenericException · Your application has presented a UIAlertController (<UIAlertController: 0x10d0a7000>) of style UIAlertControllerStyleActionSheet from StripeIdentity.IdentityFlowNavigationController (<StripeIdentity.IdentityFlowNavigationController: 0x10d08da00>). 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.

Call stack:

0
CoreFoundation
___exceptionPreprocess
1
libobjc.A.dylib
_objc_exception_throw
2
UIKitCore
-[UIPopoverPresentationController presentationTransitionWillBegin]
3
UIKitCore
___80-[UIPresentationController _initViewHierarchyForPresentationSuperview:inWindow:]_block_invoke
4
UIKitCore
___56-[UIPresentationController runTransitionForCurrentState]_block_invoke_3
5
UIKitCore
-[_UIAfterCACommitBlock run]
6
UIKitCore
-[_UIAfterCACommitQueue flush]
7
UIKitCore
__runAfterCACommitDeferredBlocks
8
UIKitCore
__cleanUpAfterCAFlushAndRunDeferredBlocks
9
UIKitCore
__UIApplicationFlushCATransaction
10
UIKitCore
__UIUpdateSequenceRun
11
UIKitCore
_schedulerStepScheduledMainSection
12
UIKitCore
_runloopSourceCallback
13
CoreFoundation
___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
14
CoreFoundation
___CFRunLoopDoSource0
15
CoreFoundation
___CFRunLoopDoSources0
16
CoreFoundation
___CFRunLoopRun
17
CoreFoundation
_CFRunLoopRunSpecific
18
GraphicsServices
_GSEventRunModal
19
UIKitCore
-[UIApplication _run]
20
UIKitCore
_UIApplicationMain
21
myapp
AppDelegate.swift:17:13
main
22
dyld
start

iOS version

iOS 16. Most notably, only iPad devices are affected.

Installation method

SPM

SDK version

23.9.1

nalexn commented 1 month ago

It's been 1 year, the issue is still present. The fix is literally 1 line of code and is carefully described by Apple inside the crash report itself. w t f?