{"action":"created","issue":{"url":"https://api.github.com/repos/openfl/extension-iap/issues/36","labels_url":"https://api.github.com/repos/openfl/extension-iap/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/openfl/extension-iap/issues/36/comments","events_url":"https://api.github.com/repos/openfl/extension-iap/issues/36/events","html_url":"https://github.com/openfl/extension-iap/issues/36","id":120627692,"number":36,"title":"Crash after purchase succeed","user":{"login":"fierysquirrel","id":9074962,"avatar_url":"https://avatars.githubusercontent.com/u/9074962?v=3","gravatar_id":"","url":"https://api.github.com/users/fierysquirrel","html_url":"https://github.com/fierysquirrel","followers_url":"https://api.github.com/users/fierysquirrel/followers","following_url":"https://api.github.com/users/fierysquirrel/following{/other_user}","gists_url":"https://api.github.com/users/fierysquirrel/gists{/gist_id}","starred_url":"https://api.github.com/users/fierysquirrel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fierysquirrel/subscriptions","organizations_url":"https://api.github.com/users/fierysquirrel/orgs","repos_url":"https://api.github.com/users/fierysquirrel/repos","events_url":"https://api.github.com/users/fierysquirrel/events{/privacy}","received_events_url":"https://api.github.com/users/fierysquirrel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-06T11:31:05Z","updated_at":"2015-12-07T18:58:42Z","closed_at":null,"body":"Hi,\r\n\r\nI'm testing a game using the iap extension, it works well on Android but on iOS it's crashing after the user makes a purchase.\r\n\r\nHere are the details of the exception:\r\n\r\n-[NSBundle appStoreReceiptURL]: unrecognized selector sent to instance 0x1e5b73e0\r\nTerminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSBundle appStoreReceiptURL]: unrecognized selector sent to instance 0x1e5b73e0'\r\n\r\nAlso, before the exception occurs, I'm seeing this on the console:\r\n\r\nSuccessful Purchase\r\n\r\nwhich makes me think that the issue is here:\r\n\r\nhttps://github.com/openfl/extension-iap/blob/master/project/iphone/InAppPurchase.mm\r\n\r\n- (void)finishTransaction:(SKPaymentTransaction*)transaction wasSuccessful:(BOOL)wasSuccessful\r\n{\r\n    if (!manualTransactionMode) [[SKPaymentQueue defaultQueue] finishTransaction:transaction];\r\n    \r\n    if(wasSuccessful)\r\n    {\r\n    \tNSLog(@\"Successful Purchase\");\r\n        NSString* receiptString = [[NSString alloc] initWithString:transaction.payment.productIdentifier];\r\n        \r\n        NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];\r\n        NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];\r\n        NSString *jsonObjectString = [receipt base64EncodedStringWithOptions:0];\r\n\r\n        sendPurchaseFinishEvent(\"success\", [transaction.payment.productIdentifier UTF8String], [transaction.transactionIdentifier UTF8String], ([transaction.transactionDate timeIntervalSince1970] * 1000), [jsonObjectString UTF8String]);\r\n    }\r\n    \r\n    else\r\n    {\r\n    \tNSLog(@\"Failed Purchase\");\r\n        if (transaction.error.code != SKErrorPaymentCancelled)\r\n        {\r\n            NSLog(@\"Transaction error: %@\", transaction.error.localizedDescription);\r\n        }\r\n        sendPurchaseEvent(\"failed\", [transaction.payment.productIdentifier UTF8String]);\r\n    }\r\n}\r\n\r\nI'm testing on an iPod touch with iOS 6.1.6\r\n\r\nI read that it happened on the share extension as well and was already fixed but I prefer to ask you directly before trying to fix it myself.\r\n\r\nIn advance thank you for your help.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/openfl/extension-iap/issues/comments/162624180","html_url":"https://github.com/openfl/extension-iap/issues/36#issuecomment-162624180","issue_url":"https://api.github.com/repos/openfl/extension-iap/issues/36","id":162624180,"user":{"login":"bryanchacosky","id":572753,"avatar_url":"https://avatars.githubusercontent.com/u/572753?v=3","gravatar_id":"","url":"https://api.github.com/users/bryanchacosky","html_url":"https://github.com/bryanchacosky","followers_url":"https://api.github.com/users/bryanchacosky/followers","following_url":"https://api.github.com/users/bryanchacosky/following{/other_user}","gists_url":"https://api.github.com/users/bryanchacosky/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanchacosky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanchacosky/subscriptions","organizations_url":"https://api.github.com/users/bryanchacosky/orgs","repos_url":"https://api.github.com/users/bryanchacosky/repos","events_url":"https://api.github.com/users/bryanchacosky/events{/privacy}","received_events_url":"https://api.github.com/users/bryanchacosky/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T18:58:42Z","updated_at":"2015-12-07T18:58:42Z","body":"Take a look at the [documentation for `NSBundle appStoreReceiptURL`](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/index.html#//apple_ref/occ/instp/NSBundle/appStoreReceiptURL). This method is only available in iOS 7.0 and later. The IAP extension has a minimum requirement of iOS 7 (not sure if this is documented or not) ... and there isn't much use in supporting anything below iOS 7 in general.\r\n\r\nThat doesn't explain why you would see the crash on iOS 9.1. Is it the exact same \"unrecognized selector\" error with the same method?"}}