iOS:如何通过 apple id 帐户(或其他)将我的应用程序安装限制为仅 2 台设备?

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

我想将我的应用程序的使用限制为最多 2 台设备,但我不知道该怎么做。我相信收据是独一无二的,但事实似乎并非如此。我想做的是将收据存储在服务器上,并将安装限制为仅限 2 台设备。我的问题是我没有找到任何唯一的ID。我无权访问 Apple 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];

有什么想法吗?

最佳答案

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

关于iOS:如何通过 apple id 帐户(或其他)将我的应用程序安装限制为仅 2 台设备?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49334619/

相关文章:

ios - 我是否拥有AudioSessionGetProperty返回的对象?

ios - 将数组传递给 NSObject 类

android - 如何在 (1024 x 1024) 中为 google play/ios 应用程序商店生成图标

ios - iTunes Connect与AES 256和CommonCrypto的导出合规性

ios - 从不同的项目向 App Store 提交更新?

iphone - 返回主屏幕

ios - 顶部的 UITextView 光标放置

objective-c - 如何将 NodeJS 和 node_modules 添加到 Mac 应用程序

ios - 在 iOS 应用程序中使用 iBeacons 时出现电池耗尽问题

iphone - 如何截断 UILabel 中字符串中的字符串?