Pen*_*One 38
这很容易.创建操作rateGame并将ID更改409954448为您的应用ID.
- (IBAction)rateGame {
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=409954448"]];
}
Run Code Online (Sandbox Code Playgroud)
这将启动AppStore应用程序并将用户直接带到他/她可以评级和审核您的应用程序的页面.如果您希望在用户加载应用程序20次之后发生这种情况,那么您可以在viewDidLoad主页面中添加警报:
- (void)viewDidLoad {
[super viewDidLoad];
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSInteger launchCount = [prefs integerForKey:@"launchCount"];
if (launchCount == 20) {
launchCount++;
[prefs setInteger:launchCount forKey:@"launchCount"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"LIKE MY APP?"
message:@"Please rate it on the App Store!"
delegate:self
cancelButtonTitle:@"NO THANKS"
otherButtonTitles:@"RATE NOW", nil];
[alert show];
[alert release];
}
}
Run Code Online (Sandbox Code Playgroud)
假设您已在AppDelegate中设置launchCount:
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSInteger launchCount = [prefs integerForKey:@"launchCount"];
launchCount++;
[prefs setInteger:launchCount forKey:@"launchCount"];
// YOUR CODE HERE
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8404 次 |
| 最近记录: |