Permalink
Browse files

Merge pull request #56 from Gerharbo/ios6

added work arround for wrong URL Scheme used in new App store on iOS 6
  • Loading branch information...
2 parents 3a9bd6c + b57fa71 commit 96bd885b16ceff985fbb79a567444053787826eb @arashpayan committed Aug 28, 2012
Showing with 15 additions and 1 deletion.
  1. +15 −1 Appirater.m
View
@@ -47,6 +47,7 @@
NSString *const kAppiraterReminderRequestDate = @"kAppiraterReminderRequestDate";
NSString *templateReviewURL = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID";
+NSString *templateReviewURLiOS6 = @"itms-apps://itunes.apple.com/LANGUAGE/app/idAPP_ID";
@interface Appirater ()
- (BOOL)connectedToNetwork;
@@ -325,7 +326,20 @@ + (void)rateApp {
NSLog(@"APPIRATER NOTE: iTunes App Store is not supported on the iOS simulator. Unable to open App Store page.");
#else
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
- NSString *reviewURL = [templateReviewURL stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%d", APPIRATER_APP_ID]];
+
+ // added work arround for wrong URL Scheme & iOS 6
+ NSString *reviewURL;
+ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) {
+ reviewURL = [templateReviewURLiOS6 stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%d", APPIRATER_APP_ID]];
+
+ reviewURL = [reviewURL stringByReplacingOccurrencesOfString:@"LANGUAGE" withString:[NSString stringWithFormat:@"%@", [[NSLocale preferredLanguages] objectAtIndex:0]]];
+
+ } else {
+ reviewURL = [templateReviewURL stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%d", APPIRATER_APP_ID]];
+ }
+
+ [[NSLocale preferredLanguages] objectAtIndex:0]
@hsoi

hsoi Aug 29, 2012

This line is missing a semi-colon at the end. Won't compile without one. :-)

@Gerharbo

Gerharbo Aug 30, 2012

Contributor

The line shouldn't be there...My bad! Ne pull request coming up.

+
[userDefaults setBool:YES forKey:kAppiraterRatedCurrentVersion];
[userDefaults synchronize];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:reviewURL]];

0 comments on commit 96bd885

Please sign in to comment.