0

I would like to limit the use of my app to 2 devices maximum, but I don't know how to do. I believed that the receipt was unique, but it seems that it is not the case. What I would like to do is store the receipt on the server, and limit the install only to 2 devices. My problem is that I don't find any unique id for that. I don't have access to the apple id and the receipt is different when installed on each devices. I believed that I could read the receipt to find an unique info but I cannot read it...

   //APP STORE VALIDATION
    NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
    NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];

    if (receipt)
    {
        /* ... Send the receipt data to your server ... */
        // Build data from dictionary

        NSString *base64Encoded = [receipt base64EncodedStringWithOptions:0];
        // Print the Base64 encoded string
        NSLog(@"Encoded: %@", base64Encoded);

        NSString *identifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

        NSString *name = [[UIDevice currentDevice] name];

        struct utsname systemInfo;
        uname(&systemInfo);
        NSString* type = [NSString stringWithCString:systemInfo.machine
                                            encoding:NSUTF8StringEncoding];

        NSString *serialNumber = [NSString stringWithFormat:@"%@ %@", [[UIDevice currentDevice] systemName], [[UIDevice currentDevice] systemVersion]]; //serial number can be rejected from app store

        NSString *url_string = @"https://xxxx.com/go2factauth/auth.php";
        url_string = [url_string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];

        NSLog(@"URL : %@", url_string);

        NSDictionary *infoDict=@{@"receipt-data":base64Encoded, @"device": @{@"udid":identifier, @"name":name , @"serialNumber":serialNumber,@"type":type}};

        [[DataManagement sharedManager] callWebServiceWithPostMethod:url_string withBytes:receipt withDict:infoDict];

Any ideas?

ΩlostA
  • 2,501
  • 5
  • 27
  • 63

1 Answers1

1

The only Apple documented way to limit iOS app installation by any unique device ID is via direct XCode install by the developer, Ad Hoc distribution by the developer, or by Enterprise licensed deployment. Not via the App store. Note that the Developer agreement might not allow selling these direct app installations. And they have an expiration date.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153