Create a receipt during IOS7 verification

I started testing in-app purchases on iOS7 and I'm working on checking receipts, but I'm confused when receipts are actually made during testing (running the app from Xcode). According to WWDC 2013 video # 508, a receipt is generated when the application is downloaded from the store. Thus, it was not surprising when I first launched the application from Xcode and did NOT find the check, since the store was not involved in the transaction. But I found this tidbit in Apple's "Check Verification Guide" :

Test During the Development Process

In order to test your main application during the development process, you need a 
valid receipt so that your application launches. To set this up, do the following:

Make sure you have Internet access so you can connect to Appleโ€™s servers.
Launch your application by double-clicking on it (or in some way cause Launch Services 
to launch it). After you launch your application, the following occurs:

Your application fails to validate its receipt because there is no receipt present, and 
it exits with a status of 173.
The system interprets the exit status and attempts to obtain a valid receipt. Assuming 
your application signing certificate is valid, the system installs a valid receipt for the
application. The system may prompt you for your iTunes credentials.
The system relaunches your application, and your application successfully validates the
receipt.
With this development receipt installed, you can launch your application by any 
methodโ€”for  example, with gdb or the Xcode debugger.

So, I tried the following code:

NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
if (!receipt)
{
    NSLog(@"    No receipt found!");
    exit(173);

What really says: "No receipts found" and will be released. I restarted the application from the device. He quickly went out. I restarted with Xcode, it came out again ... no receipt.

. , , - , : โ€‹โ€‹ ?

,

+4

Source: https://habr.com/ru/post/1532239/


All Articles