1

The Receigen documentation, and other sources, suggest validating your app’s receipt as soon as possible, early in the main method even.

When I call the Receigen-generated code in main method, I get a execution-interruption when the app has no Receipt.

int main(int argc, char *argv[])
{

    @autoreleasepool {

       MyPrefix_CheckReceipt( [[MyReceiptRefreshDelegate alloc] init] );

       return UIApplicationMain(argc, argv, nil, NSStringFromClass([XMAppDelegate class]));
    }
}

The call to return UIApplicationMain shows this error message in Xcode 7.3.1:

Thread 1: EXC_BAD_ACCESS (code=1, address=0xe)

Moving this call to MyPrefix_CheckReceipt from main method to the top of my app delegate’s didFinishLaunchingWithOptions method is a workaround. No EXC_BAD_ACCESS error occurs when receipt is not present.

Having no Receipt can happen in the field when a user restores their app from a backup via iTunes app on a Mac or PC. And having no Receipt always happens in development when executing via Xcode on a real hardware iOS device for the first time or after having deleted the app from device.

Running a second time exhibits no such error. I verified the receipt is successfully retrieved from the fake "sandbox" App Store, and is present on the second run.

So the Question is: Why does the Receigen code fail with a crash when no Receipt is found but only when the verification call is made from the main method?

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • Have you solved this or found anything useful on the matter? – Ian Bytchek Nov 30 '16 at 05:33
  • @IanBytchek Nope, bug still occurring. The Eeceipt is successfully downloaded. So after crash when user relaunches the app, all is well again. The crash is an unfortunate user experience, but one that will only happen to a user who backed up their iOS device to a Mac or PC and restored - somewhat rare occurrence. And happens to us developers often, when we install the app via Xcode for testing. When installing an app from the App Store directly to device, the Receipt is always included so no crash from Receigen. – Basil Bourque Nov 30 '16 at 08:06

0 Answers0