我们怎样才能在iOS应用中制作“请在应用程序商店中查看”功能性PopUp?
答案 0 :(得分: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"]];
}
这将启动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];
}
}
这假设你已经在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
}
答案 1 :(得分:7)
我个人使用过这个。我认为它的效果非常好。 http://arashpayan.com/blog/2009/09/07/presenting-appirater/
答案 2 :(得分:4)
如果您希望用户在20次后查看您的应用,则会丢失代码。缺少的部分是
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
// user hit dismiss so don't do anything
}
else if (buttonIndex == 1) //review the app
{
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=409954448"]];
}
}
答案 3 :(得分:2)
好吧,here's one.
这些通常是简单的UIAlertViews,带有三个按钮(立即审阅,稍后,从不),优先级存储在NSUserDefaults中,用于指示用户是否已经这样做,他们是否希望再次被要求等等。
答案 4 :(得分:2)
iRate也是另一个提供“评价此应用”对话框的好图书馆。
答案 5 :(得分:0)
自iOS 10.3起,iOS为此提供了一项功能。
import StoreKit
SKStoreReviewController.requestReview()
可以在我的GitHubAccount上找到完整的类how to request Appstore Reviews。
干杯!