Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rate this app in iOS

I have used the iRate class to add 'rate my app' functionality. I have added my app bundle ID. But when I run the app it shows "Cannot connect to 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"];

    }

}
like image 945
Minkle Garg Avatar asked Jun 03 '13 11:06

Minkle Garg


1 Answers

Not familiar with iRate, I often uses 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!

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).

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:

enter image description here

If it is not yet released you can find it by going to iTunes Connect ->> tapping "Manage Your Apps" -->> tapping your app. You app ID will be seen here enter image description here

Hope it helps!

like image 106
Groot Avatar answered Oct 09 '22 04:10

Groot