在iOS中为此应用评分

前端之家收集整理的这篇文章主要介绍了在iOS中为此应用评分前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经使用 iRate类来添加’rate我的应用程序’功能.我已经添加了我的应用程序包ID.但是当我运行应用程序时,显示“无法连接到iTunes Store”.请帮我找出问题.

这是我使用的代码

-(void)applicationWillEnterForeground:(UIApplication *)application
{
    NSUserDefaults *times=[NSUserDefaults standardUserDefaults];
    int test=[[times objectForKey:@"time"]intValue];
    NSLog(@"test..:%d",test);
    if (test >=5) {

        [iRate sharedInstance].applicationBundleID = @"com.01Synergy";
        [iRate sharedInstance].onlyPromptIfLatestVersion = NO;

        //enable preview mode
        [iRate sharedInstance].previewmode = YES;
    }
}
- (void)applicationDidEnterBackground:(UIApplication *)application {

    NSUserDefaults *times=[NSUserDefaults standardUserDefaults];

    int time=[[times objectForKey:@"time"]intValue];

    if (time<5) {
        time++;
        [times setInteger:time forKey:@"time"];

    }

}

解决方法

我不熟悉iRate,我经常使用 Appirater.它是非常容易实现.简单通话
[Appirater setAppId:@"380245121"];    // Change for your "Your APP ID"
[Appirater setDaysUntilPrompt:0];     // Days from first entered the app until prompt
[Appirater setUsesUntilPrompt:5];     // Number of uses until prompt
[Appirater setTimeBeforeReminding:2]; // Days until reminding if the user taps "remind me"
//[Appirater setDebug:YES];           // If you set this to YES it will display all the time

用户在第五次进入应用程序后显示

说你已经做了[Appirater setUsesUntilPrompt:5]和[Appirater setDaysUntilPrompt:2],这意味着从第一个应用程序条目的时间必须是2天(或更多)和应用程序使用次数(应用程序进入前台/推出)必须是5倍(或更多).

您的目的代码示例:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [Appirater setAppId:@"380245121"];    // Change for your "Your APP ID"
    [Appirater setDaysUntilPrompt:0];     // Days from first entered the app until prompt
    [Appirater setUsesUntilPrompt:5];     // Number of uses until prompt
    [Appirater setTimeBeforeReminding:2]; // Days until reminding if the user taps "remind me"
    //[Appirater setDebug:YES];           // If you set this to YES it will display all the time

    //... Perhaps do stuff

    [Appirater appLaunched:YES];

    return YES;
}

- (void)applicationWillEnterForeground:(UIApplication *)application{
    [Appirater appEnteredForeground:YES];
}

如果您的应用在App Store上,您可以在URL中找到应用ID:

如果尚未发布,您可以通过访问iTunes Connect – >>>点击“管理您的应用” – >>点击你的应用程序你的应用程序ID将在这里看到

希望有帮助!

猜你在找的iOS相关文章