简体   繁体   English

在iOS中为此应用评分

[英]Rate this app in iOS

I have used the iRate class to add 'rate my app' functionality. 我使用iRate类添加'评价我的应用'功能。 I have added my app bundle ID. 我添加了我的应用包ID。 But when I run the app it shows "Cannot connect to iTunes Store". 但是当我运行应用程序时,它会显示“无法连接到iTunes Store”。 Please help me out to find the issue. 请帮我找出问题。

This is the code I'm using: 这是我正在使用的代码:

-(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"];

    }

}

Not familiar with iRate, I often uses Appirater . 不熟悉iRate,我经常使用Appirater It is extremely easy to implement. 非常容易实现。 Simple call 简单的电话

[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

to have it show after the user have entered the app the 5th time! 在用户第5次进入应用程序后显示!

Say you have done [Appirater setUsesUntilPrompt:5] and [Appirater setDaysUntilPrompt:2] it means that the time from first app entry has to be 2 days (or more) AND the number of app uses (number of times the application entered foreground/launched) has to be 5 times (or more). 假设你已经完成了[Appirater setUsesUntilPrompt:5][Appirater setDaysUntilPrompt:2]这意味着第一个应用程序输入的时间必须是2天(或更多) 应用程序使用的数量(应用程序输入前景的次数/推出)必须是5次(或更多)。

Sample code for your purpose: 用于您目的的示例代码:

- (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];
} 

If your app is out on App Store you can find the app ID in the URL: 如果您的应用程序在App Store上,您可以在URL中找到应用程序ID:

在此输入图像描述

If it is not yet released you can find it by going to iTunes Connect ->> tapping "Manage Your Apps" -->> tapping your app. 如果尚未发布,您可以通过访问iTunes Connect - >>点击“管理您的应用” - >>点击您的应用来找到它。 You app ID will be seen here 您的应用ID将在此处显示 在此输入图像描述

Hope it helps! 希望能帮助到你!

The problem is with your bundle ID. 问题在于您的捆绑包ID。 Currently it's set to @"com.01Synergy" but it's your developer ID. 目前它设置为@“com.01Synergy”,但它是您的开发者ID。 Bundle ID you can see in iOS Application Target section in Xcode . 您可以在Xcode iOS Application Target部分中看到的Bundle ID。

Btw, I also use iRate and there is no need to use [iRate sharedInstance].applicationBundleID = @"com.01Synergy"; 顺便说一下,我也使用iRate,不需要使用[iRate sharedInstance].applicationBundleID = @"com.01Synergy"; , so just comment it. ,所以只是评论它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM