Closed hughlang closed 8 years ago
@saturngod do you agree this is the appropriate place to put this?
adding [[SKPaymentQueue defaultQueue] removeTransactionObserver:self]; in dealloc didn't work for me and the app still crashing on iOS 7
@mohammad19991 , sorry about that. I will test now and let know you after that.
@saturngod No worries, look I didn't know what's the problem but something is getting deallocated from the memory and the crash only happens on iOS 7 and I couldn't find it so I rolled back last commit in my code and it's working better now but the crash still happening a little.
@mohammad19991 , may I know are you using [IAPShare sharedHelper].iap or you just allocate your own object like
IAPHelper *iap = [[IAPHelper alloc] initWithProductIdentifiers:dataSet]
Look like it already dealloc the IAPHelper but transaction is not finish yet
May I know , how did you allocate the object.
Or , did you dealloc the iap like
[IAPShare sharedHelper].iap = nil;
If it's , may I know where did you put
I alloc the object like below:
[IAPShare sharedHelper].iap = [[IAPHelper alloc] initWithProductIdentifiers:Identifiers];
and I don't use [IAPShare sharedHelper].iap = nil; to dealloc the objects
I was having a problem where I would occasionally get the following error while trying to restore products. (only if NSZombieEnabled)
[IAPHelper respondsToSelector:]: message sent to deallocated instance 0x17668730
I found that I had to add this somewhere in the IAPHelper.m code:
I chose to put it in a dealloc method, though there might be better places for this. It did fix my problem though.
See also: http://stackoverflow.com/questions/4150926/in-app-purchase-crashes-on-skpaymentqueue-defaultqueue-addpaymentpayment