nicklockwood / iRate

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

iOS 11 (GM) prompts at launch even though promptAtLaunch set to NO & Submit button fails #310

Open shutterzee opened 6 years ago

shutterzee commented 6 years ago

Under iOS 11 GM in an app built with Xcode 8.3.3 (and currently in the app store) I'm seeing first launch of the day produce the prompt. I've seen this occur twice now.

Additionally, when this occurs, the Submit button does nothing. The cancel and Not Now buttons work, however.

In our application:didFinishLaunchingWithOptions: we configure as follows:

    //configure iRate
    [iRate sharedInstance].daysUntilPrompt = 0;
    [iRate sharedInstance].usesUntilPrompt = 0;
    [iRate sharedInstance].remindPeriod = 0;
    [iRate sharedInstance].promptAtLaunch = NO;

That is the only iRate code at app startup. Later in the lifecycle we explicitly call

    if ([[iRate sharedInstance] shouldPromptForRating]) {
        [[iRate sharedInstance] promptForRating];
    }
shutterzee commented 6 years ago

I had some time to look into this further...since iRate implements + (void)load it actually is loaded before application:didFinishLaunchingWithOptions: is called and therefore ignores the changes we are making to the settings since it actually begins the startup prompt mechanism sooner than expected. A potential work-around in our app that I'm experimenting with is to implement + (void)load for our app delegate class. Initializing iRate in that method actually works - although I'm not sure of what crazy other side-effects that may cause.

Additionally, I now see that some of the example code uses +initialize to initialize iRate but the pod documentation talks about application:didFinishLaunchingWithOptions: - I think +initialize is another option but +load seems slightly safer in my case.

sitefeng commented 6 years ago

In swift 4 iOS 11, the submit button is disabled when initializing from application:didFinishLaunchingWithOptions: or init functions from the AppDelegate. initialize and load function overrides are not permitted in Swift

bvirlet commented 6 years ago

We've seen a similar issue. While implementing the the + load in iRate make it "magic", it causes undefined behavior because there is no control as to when +load is called. The proof of this undefined behavior is this bug affecting iOS 11.

We think that load should be removed as it causes these problems.

zapjonny commented 6 years ago

I'm seeing that promptAtLaunch = false has no effect if app is launched at least 10 times, and used for at least 10 days since first launch. I think promptAtLaunch is broken, or badly documented. Alas, this project is deprecated? Tested on iOS 11.0, iPhone SE.

btw using eventsUntilPrompt = 2 and daysUntilPrompt = 0.0 (it's weird that I still have to wait 10 days to cause the bug though)

zapjonny commented 6 years ago

I had some time to look into this further...since iRate implements + (void)load it actually is loaded before application:didFinishLaunchingWithOptions: is called and therefore ignores the changes we are making to the settings since it actually begins the startup prompt mechanism sooner than expected. A potential work-around in our app that I'm experimenting with is to implement + (void)load for our app delegate class. Initializing iRate in that method actually works - although I'm not sure of what crazy other side-effects that may cause.

Okay this explains why the bug I am seeing happens only after ten days, and not directly as would be expected.

zapjonny commented 6 years ago

Okay only now I read all your comments through properly, and I just have to wonder, did any of you guys figure out a workaround for this using Swift (3/4)? Also, I am using iRate below 1.12 (probably 1.11.7 as of iRate.h), not sure if that makes a huge difference though.

@bvirlet @shutterzee @sitefeng

Sorry for the ping.

bvirlet commented 6 years ago

Fork the repo and remove the +load method.

zapjonny commented 6 years ago

Thanks!

I guess that is one way, or we'll just reconsider. I don't think we'll use any library for reviews going forward.

Thanks iRate. 🙏🏻