【问题标题】:iOS: How to limit the installation of my app to only 2 devices by apple id account (or else)?iOS:如何通过 Apple id 帐户(或其他)将我的应用程序的安装限制为仅 2 台设备?
【发布时间】:2018-03-17 09:49:33
【问题描述】:

我想将我的应用程序的使用限制为最多 2 台设备,但我不知道该怎么做。我认为收据是独一无二的,但似乎并非如此。我想做的是将收据存储在服务器上,并将安装限制为 2 台设备。我的问题是我没有找到任何唯一的ID。我无权访问苹果 ID,并且在每台设备上安装时收据都不同。我相信我可以阅读收据以找到唯一信息,但我无法阅读...

   //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];

有什么想法吗?

【问题讨论】:

  • 通过 App Store 或 Development iPA 分发应用程序?
  • @NaumanMalik 通过应用商店...

标签: ios objective-c app-store appstore-approval receipt-validation


【解决方案1】:

Apple 记录的通过任何唯一设备 ID 限制 iOS 应用安装的唯一方法是开发人员通过直接 XCode 安装、开发人员通过 Ad Hoc 分发或通过企业许可部署。不是通过应用商店。请注意,开发者协议可能不允许销售这些直接安装的应用程序。而且它们有一个有效期。

【讨论】:

    猜你喜欢
    • 2018-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-12
    • 1970-01-01
    • 2014-05-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多