nicklockwood / iRate

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

Facillitate running under a feature flag #244

Closed J-Swift closed 7 years ago

J-Swift commented 8 years ago

Hi, thanks for the project, it looks great!

I was including this via carthage, and am setting up the ability to enable/disable via a feature flag (ENABLE_APP_RATING), but even if the flag is disabled, the class still goes through the process of initializing the singleton and everything else that comes with that.

This is due to hooking into +load which is guaranteed to be called regardless of if the user ever accesses the class. I've changed this to use +initialize, which will only run once the user actually calls into the class, and can thus be avoided outright if they so choose.

I did a quick scan to see if there was any particular reason you might have used the former strategy but nothing jumped out. Let me know if I missed something in that regard.

nicklockwood commented 7 years ago

I use +load to support zero config (no need to reference iRate in code - it just works).

If you want to disable iRate with a feature flag, you can do so by setting [iRate sharedInstance].promptAtLaunch = NO; in your app delegate.