【发布时间】: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