Avoid 0xdead10cc crashes in iRate.
This commit is contained in:
parent
fe12774406
commit
f2fc2b9004
|
@ -162,7 +162,7 @@ typedef NS_ENUM(NSUInteger, iRateErrorCode) {
|
|||
- (BOOL)shouldPromptForRating;
|
||||
- (void)promptForRating;
|
||||
- (void)promptIfNetworkAvailable;
|
||||
- (void)promptIfAllCriteriaMet;
|
||||
- (BOOL)promptIfAllCriteriaMet;
|
||||
- (void)openRatingsPageInAppStore;
|
||||
- (void)logEvent:(BOOL)deferPrompt;
|
||||
- (void)preventPromptAtNextTest;
|
||||
|
|
|
@ -129,7 +129,7 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
|
|||
@property (nonatomic, assign) BOOL checkingForPrompt;
|
||||
@property (nonatomic, assign) BOOL checkingForAppStoreID;
|
||||
@property (nonatomic, assign) BOOL shouldPreventPromptAtNextTest;
|
||||
|
||||
@property (nonatomic) BOOL hasPromptedAtLaunch;
|
||||
@property (nonatomic) BOOL hasQueuedSynchronize;
|
||||
|
||||
@end
|
||||
|
@ -792,10 +792,15 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
|
|||
}
|
||||
}
|
||||
|
||||
- (void)promptIfAllCriteriaMet {
|
||||
- (BOOL)promptIfAllCriteriaMet {
|
||||
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
|
||||
return NO;
|
||||
}
|
||||
if ([self shouldPromptForRating]) {
|
||||
[self promptIfNetworkAvailable];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)showRemindButton {
|
||||
|
@ -972,9 +977,6 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
|
|||
- (void)applicationWillEnterForeground {
|
||||
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
|
||||
[self incrementUseCount];
|
||||
if (self.promptAtLaunch) {
|
||||
[self promptIfAllCriteriaMet];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -996,6 +998,11 @@ static NSString *const iRateMacAppStoreURLFormat = @"macappstore://itunes.apple
|
|||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
self.hasQueuedSynchronize = NO;
|
||||
}
|
||||
if (self.promptAtLaunch && !self.hasPromptedAtLaunch) {
|
||||
if ([self promptIfAllCriteriaMet]) {
|
||||
self.hasPromptedAtLaunch = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)openRatingsPageInAppStore {
|
||||
|
|
Loading…
Reference in New Issue