Get App Version install using testflight

0 votes
asked Sep 11, 2017 by iphonemaclover

I can easily get Version of my app in appstore with below API of apple:-

Also i can check if app is install from testflight or appstore with below code :-

if ([[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]) {
    // TestFlight
} else {
    // App Store (and Apple reviewers too)

My question is that , how to get version of my app install by testflight. For eg: My release appstore version in 1.0.1 while i have testflight upload version is 1.0.10, i need to check testflight uploaded app version.

here is my code to check version from appstore

    NSString *urlString = @"";
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]];
    [request setHTTPMethod:@"GET"];

    NSError *error = nil;
    NSURLResponse *response = nil;
    NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
    if (!error)

        //The response is in data
        //NSLog(@"Success: %@", stringReply);
        NSDictionary *dictResponse = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
        float appStoreTestflightVersion=[[[[dictResponse objectForKey:@"results"] firstObject] objectForKey:@"version"] floatValue];

        NSLog(@"app stroe version=%f",appStoreTestflightVersion);

        NSString *strLocalVersion=[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
        float localAppVersion=[strLocalVersion floatValue];
        if (localAppVersion!=appStoreTestflightVersion)

            //delete database here and then create it again



Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter