Permalink
Browse files

*Fixed a memory leak

*App url goes directly to store instead of through iTunes first (thanks, maddox)
*Cleaned up the README
  • Loading branch information...
1 parent 4cbab7e commit 254bf8c46df6ff78875fea0ae176194e00cbdb48 arashpayan committed Feb 19, 2010
Showing with 18 additions and 18 deletions.
  1. +3 −3 Appirater.h
  2. +10 −11 Appirater.m
  3. +5 −4 README
View
6 Appirater.h
@@ -1,7 +1,7 @@
/*
This file is part of Appirater.
- Copyright (c) 2009, Arash Payan
+ Copyright (c) 2010, Arash Payan
All rights reserved.
Permission is hereby granted, free of charge, to any person
@@ -31,7 +31,7 @@
*
* Created by Arash Payan on 9/5/09.
* http://arashpayan.com
- * Copyright 2009 Arash Payan. All rights reserved.
+ * Copyright 2010 Arash Payan. All rights reserved.
*/
#import <Foundation/Foundation.h>
@@ -94,7 +94,7 @@ extern NSString *const kAppiraterDeclinedToRate;
'YES' will show the Appirater alert everytime. Useful for testing how your message
looks and making sure the link to your app's review page works.
*/
-#define APPIRATER_DEBUG NO
+#define APPIRATER_DEBUG YES
@interface Appirater : NSObject <UIAlertViewDelegate> {
View
21 Appirater.m
@@ -1,7 +1,7 @@
/*
This file is part of Appirater.
- Copyright (c) 2009, Arash Payan
+ Copyright (c) 2010, Arash Payan
All rights reserved.
Permission is hereby granted, free of charge, to any person
@@ -31,7 +31,7 @@
*
* Created by Arash Payan on 9/5/09.
* http://arashpayan.com
- * Copyright 2009 Arash Payan. All rights reserved.
+ * Copyright 2010 Arash Payan. All rights reserved.
*/
#import "Appirater.h"
@@ -44,7 +44,7 @@
NSString *const kAppiraterRatedCurrentVersion = @"kAppiraterRatedCurrentVersion";
NSString *const kAppiraterDeclinedToRate = @"kAppiraterDeclinedToRate";
-NSString *templateReviewURL = @"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=APP_ID&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software";
+NSString *templateReviewURL = @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=APP_ID&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software";
@interface Appirater (hidden)
- (BOOL)connectedToNetwork;
@@ -103,6 +103,8 @@ - (void)_appLaunched {
return;
}
+ BOOL willShowPrompt = NO;
+
// get the app's version
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
@@ -150,7 +152,10 @@ - (void)_appLaunched {
!ratedApp)
{
if ([self connectedToNetwork]) // check if they can reach the app store
+ {
+ willShowPrompt = YES;
[self performSelectorOnMainThread:@selector(showPrompt) withObject:nil waitUntilDone:NO];
+ }
}
}
else
@@ -165,6 +170,8 @@ - (void)_appLaunched {
[userDefaults synchronize];
+ if (!willShowPrompt)
+ [self autorelease];
[pool release];
}
@@ -181,14 +188,6 @@ - (void)showPrompt {
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
- //if (buttonIndex == 1)
-// {
-// NSString *reviewURL = [templateReviewURL stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%d", APPIRATER_APP_ID]];
-// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:reviewURL]];
-//
-// [userDefaults setBool:YES forKey:kAppiraterRatedCurrentVersion];
-// }
-
switch (buttonIndex) {
case 0:
{
View
9 README
@@ -1,15 +1,16 @@
Introduction
------------
Appirater is a class that you can drop into any iPhone app that will help remind your users
-to review your app on the App Store. The code is released under the LGPL, so feel free to
+to review your app on the App Store. The code is released under the MIT/X11, so feel free to
modify and share your changes with the world. To find out more, check out the project
homepage: http://arashpayan.com/blog/index.php/2009/09/07/presenting-appirater/
Getting Started
---------------
-Add the Appirater code into your project and call [Appirater appLaunched] at the end of
-your app delegate's application:didFinishLaunchingWithOptions: method. Finally, set the
-APPIRATER_APP_ID in Appirater.h to your Apple provided software id.
+1) Add the Appirater code into your project
+2) Add the CFNetwork and SystemConfiguration frameworks to your project
+3) Call [Appirater appLaunched] at the end of your app delegate's application:didFinishLaunchingWithOptions: method.
+4) Finally, set the APPIRATER_APP_ID in Appirater.h to your Apple provided software id.
License
-------

0 comments on commit 254bf8c

Please sign in to comment.