wimagguc / ios-custom-alertview

Custom UIAlertView. Continue adding images and UIViews to dialogs in iOS7+
Other
1.66k stars 394 forks source link

Do not assume the first found window in [[UIApplication sharedApplication] windows] to be the right one #111

Closed ov1d1u closed 7 years ago

ov1d1u commented 7 years ago

Before showing the alert view it is added on the first object found in [[UIApplication sharedApplication] windows]. Starting with iOS 9 Apple introduced a feature called Picture in Picture; when this feature is enabled the first found window will be an object of type PGHostedWindow which holds the popup view of the PiP feature (note that thiss happens only on iPads). Trying to add the alert view on that window will make the alert view to not appear at all. This pull request fixes that by looking on the first object in [[UIApplication sharedApplication] windows] which is exactly a type of UIWindow class.

ov1d1u commented 7 years ago

Actually this was already fixed by goutallier, which done it better than me, so discard this pull request and use the one from him.