Closed fierysquirrel closed 8 years ago
Also the same code was tested on iOS 9.1 and the same crash happened
How often does this happen?
Take a look at the documentation for 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.
That 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?
Thank you for you reply, sorry for the delay.
You are right about the version supporting, I didn't know that, I actually do not have a lot of experience with iOS native code but I found something that probably could help improve the current code:
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
NSData* data = nil;
if (version < 7) {
data = transaction.transactionReceipt;
} else {
NSURL* receiptUrl = [[NSBundle mainBundle] appStoreReceiptURL];
if ([[NSFileManager defaultManager]
fileExistsAtPath:[receiptUrl path]]) { data = [NSData dataWithContentsOfURL:receiptUrl]; } }
I also understand this is not really necessary considering that a lot of people are using > 7 versions of iOS but I guess it will prevent having this issue again.
I could add it to the code if you want.
About the 9.1 issue, I'm not completely sure it was caused by this, I will check and let you know.
Thank you for the support.
2015-12-08 3:58 GMT+09:00 Bryan Chacosky notifications@github.com:
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.
That 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?
— Reply to this email directly or view it on GitHub https://github.com/openfl/extension-iap/issues/36#issuecomment-162624180 .
Henry Fernández Fiery Squirrel http://www.fierysquirrel.com/
I'm not sure if that change is enough to resolve the issue. When iOS 7 was released, Apple began migrating their receipt system to use a global receipt to hold the other receipts (which is what appStoreReceiptURL
returns) and deprecated the "receipt per purchase" style. More so to the point, there are less than 5% of users on iOS 6.0 and under - which would yield very little return on a change to add support.
If you'd like to make a pull request, I'll leave it to other contributors to determine if the request should be pulled in or not. But my stance is to not bother with it.
It's ok, I don't really think it's an important issue, this is the device I have at the moment to test but I guess I'll get a newer one.
Thank you very much for your help.
2015-12-10 14:02 GMT+09:00 Bryan Chacosky notifications@github.com:
I'm not sure if that change is enough to resolve the issue. When iOS 7 was released, Apple began migrating their receipt system to use a global receipt to hold the other receipts (which is what appStoreReceiptURL returns) and deprecated the "receipt per purchase" style. More so to the point, there are less than 5% of users on iOS 6.0 and under https://david-smith.org/iosversionstats/ - which would yield very little return on a change to add support.
If you'd like to make a pull request, I'll leave it to other contributors to determine if the request should be pulled in or not. But my stance is to not bother with it.
— Reply to this email directly or view it on GitHub https://github.com/openfl/extension-iap/issues/36#issuecomment-163488106 .
Henry Fernández Fiery Squirrel http://www.fierysquirrel.com/
@fierysquirrel If you truly don't think it's important then please close unless you're planning to push the PR for it. This repo doesn't get as much love as I wished it did.
Hi,
I'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.
Here are the details of the exception:
-[NSBundle appStoreReceiptURL]: unrecognized selector sent to instance 0x1e5b73e0 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSBundle appStoreReceiptURL]: unrecognized selector sent to instance 0x1e5b73e0'
Also, before the exception occurs, I'm seeing this on the console:
Successful Purchase
which makes me think that the issue is here:
https://github.com/openfl/extension-iap/blob/master/project/iphone/InAppPurchase.mm
(void)finishTransaction:(SKPaymentTransaction*)transaction wasSuccessful:(BOOL)wasSuccessful { if (!manualTransactionMode) [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
if(wasSuccessful) { NSLog(@"Successful Purchase"); NSString* receiptString = [[NSString alloc] initWithString:transaction.payment.productIdentifier];
}
else { NSLog(@"Failed Purchase"); if (transaction.error.code != SKErrorPaymentCancelled) { NSLog(@"Transaction error: %@", transaction.error.localizedDescription); } sendPurchaseEvent("failed", [transaction.payment.productIdentifier UTF8String]); } }
I'm testing on an iPod touch with iOS 6.1.6
I 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.
In advance thank you for your help.