nicklockwood / iRate

[DEPRECATED]
http://charcoaldesign.co.uk/source/cocoa#irate
Other
4.1k stars 733 forks source link

use of UIAlertViewController conflicts with presenting UINavigationControllers #191

Open aporat opened 9 years ago

aporat commented 9 years ago

on app launch, i'm displaying a standard UIAlertView which it's main purpose is to present a UINavigationController when the user clicks on the UIAlertView's positive button.

If iRate already presented it's UIAlertViewController, the app will fail to present the UINavigationController as iRate's UIAlertViewController is already being presented. this is a major issue, as iRate usually fires on app launch. The user can't even dismiss iRate's UIAlertViewController, as my UIAlertView is displayed on top of UIAlertViewController.

It would be wise to revert the UIAlertViewController and reconsider the effects of presenting a UIViewController instead of using a standard UIAlertView.

see warning below:

2014-10-24 15:30:57.900 xxxxxxxx[87618:1340476] Warning: Attempt to present <UINavigationController: 0x7ff38bde74e0>  on <CoinsViewController: 0x7ff38bd29be0> which is already presenting (null)

my workaround is to revert to version 1.10.3

nicklockwood commented 9 years ago

Hmm. This is problematic, but UIAlertView is deprecated, so not supporting UIAlertController isn't really a long-term solution. I guess I can add an option to not use UIAlertController for now, but at some point it will probably become mandatory.

aporat commented 9 years ago

no doubt at some point UIAlertView will have to go. However, the issues with presenting a UIViewController instead of an UIAlertView on app launch might break logic in many apps, and the developers won't be even aware of these changes.

I doubt developers will know they need to turn off a flag to prevent this issue from occurring. perhaps there's a way to auto dismiss iRate controller if another viewcontroller is trying to be presented?

nicklockwood commented 9 years ago

OK, I've added a property "useUIAlertControllerIfAvailable", and set it to NO by default.

nicklockwood commented 9 years ago

I can imagine this will cause some pain in future, but it should solve the problem for now.

aporat commented 9 years ago

thanks for the quick fix! the fact the flag is NO by default makes sense.

I wonder if UIAlertViewController can be used safely within irate in the future, as presenting view controllers "outside" the app logic can be tricky.