diff --git a/UAAppReviewManager.h b/UAAppReviewManager.h index ea51d4c..099daef 100644 --- a/UAAppReviewManager.h +++ b/UAAppReviewManager.h @@ -8,10 +8,13 @@ // -#import +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) #import -#import +#else +#import +#endif +#import //! Project version number for UAAppReviewManager. FOUNDATION_EXPORT double UAAppReviewManagerVersionNumber; diff --git a/UAAppReviewManager.m b/UAAppReviewManager.m index e3d32b9..bb4c32d 100644 --- a/UAAppReviewManager.m +++ b/UAAppReviewManager.m @@ -10,6 +10,7 @@ #import "UAAppReviewManager.h" #import +#import #include #if ! __has_feature(objc_arc) @@ -833,46 +834,53 @@ - (BOOL)userHasRatedCurrentVersion { #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - (void)showRatingAlert { - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:self.reviewTitle - message:self.reviewMessage - delegate:self - cancelButtonTitle:self.cancelButtonTitle - otherButtonTitles:(self.showsRemindButton ? self.remindButtonTitle : self.rateButtonTitle), // If we have a remind button, show it first. Otherwise show the rate button - (self.showsRemindButton ? self.rateButtonTitle : nil), // If we have a remind button, show the rate button next. Otherwise stop adding buttons. - nil]; - alertView.cancelButtonIndex = -1; - self.ratingAlert = alertView; - [alertView show]; - - if (self.didDisplayAlertBlock) - self.didDisplayAlertBlock(); + if (UAAppReviewManagerSystemVersionGreaterThanOrEqualTo(@"10.3")) { + [SKStoreReviewController requestReview]; + [self remindMeLater]; + } + else { + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:self.reviewTitle + message:self.reviewMessage + delegate:self + cancelButtonTitle:self.cancelButtonTitle + otherButtonTitles:(self.showsRemindButton ? self.remindButtonTitle : self.rateButtonTitle), // If we have a remind button, show it first. Otherwise show the rate button + (self.showsRemindButton ? self.rateButtonTitle : nil), // If we have a remind button, show the rate button next. Otherwise stop adding buttons. + nil]; + alertView.cancelButtonIndex = -1; + self.ratingAlert = alertView; + [alertView show]; + } + + if (self.didDisplayAlertBlock) { + self.didDisplayAlertBlock(); + } } #else - (void)showRatingAlert { - NSAlert *alert = [NSAlert new]; - alert.messageText = self.reviewTitle; - alert.informativeText = self.reviewMessage; - [alert addButtonWithTitle:self.rateButtonTitle]; - [alert addButtonWithTitle:self.remindButtonTitle]; - [alert addButtonWithTitle:self.cancelButtonTitle]; - self.ratingAlert = alert; - - NSWindow *window = [[NSApplication sharedApplication] keyWindow]; - if (window) { - // TODO: Deprecated function - [alert beginSheetModalForWindow:[[NSApplication sharedApplication] keyWindow] - modalDelegate:self - didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) - contextInfo:nil]; - } else { - NSInteger returnCode = [alert runModal]; - [self handleNSAlertReturnCode:returnCode]; - } - - if (self.didDisplayAlertBlock) - self.didDisplayAlertBlock(); + NSAlert *alert = [NSAlert new]; + alert.messageText = self.reviewTitle; + alert.informativeText = self.reviewMessage; + [alert addButtonWithTitle:self.rateButtonTitle]; + [alert addButtonWithTitle:self.remindButtonTitle]; + [alert addButtonWithTitle:self.cancelButtonTitle]; + self.ratingAlert = alert; + + NSWindow *window = [[NSApplication sharedApplication] keyWindow]; + if (window) { + // TODO: Deprecated function + [alert beginSheetModalForWindow:[[NSApplication sharedApplication] keyWindow] + modalDelegate:self + didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) + contextInfo:nil]; + } else { + NSInteger returnCode = [alert runModal]; + [self handleNSAlertReturnCode:returnCode]; + } + + if (self.didDisplayAlertBlock) + self.didDisplayAlertBlock(); } #endif diff --git a/UAAppReviewManager.podspec b/UAAppReviewManager.podspec index 3d7783b..ed9f109 100644 --- a/UAAppReviewManager.podspec +++ b/UAAppReviewManager.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "UAAppReviewManager" - s.version = "0.2.6" + s.version = "0.2.7" s.summary = "UAAppReviewManager is a simple and lightweight App review prompting tool for iOS and Mac App Store apps." s.description = <<-DESC UAAppReviewManager is a simple and lightweight App review prompting tool for iOS and Mac App Store apps. It allows you to use it on iOS and Mac targets, allows affiliate links and it rewritten from the ground up for the modern, primetime app.