Skip to content

Commit

Permalink
*Fixed a memory leak
Browse files Browse the repository at this point in the history
*App url goes directly to store instead of through iTunes first (thanks, maddox)
*Cleaned up the README
  • Loading branch information
arashpayan committed Feb 19, 2010
1 parent 4cbab7e commit 254bf8c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions 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
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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> {

Expand Down
21 changes: 10 additions & 11 deletions 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
Expand Down Expand Up @@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -103,6 +103,8 @@ - (void)_appLaunched {
return;
}

BOOL willShowPrompt = NO;

// get the app's version
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];

Expand Down Expand Up @@ -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
Expand All @@ -165,6 +170,8 @@ - (void)_appLaunched {


[userDefaults synchronize];
if (!willShowPrompt)
[self autorelease];

[pool release];
}
Expand All @@ -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:
{
Expand Down
9 changes: 5 additions & 4 deletions 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
-------
Expand Down

0 comments on commit 254bf8c

Please sign in to comment.