I have a problem with in-app. I have 2 in-apps in my app. But when I bought first and than i wanna buy second my app crash and it show me error Thread 1: EXC_BAD_ACCESS(code=1, address=0x10)
. On line with [[SKPaymentQueue defaultQueue] addPayment:payment];
Can you help me?
Asked
Active
Viewed 803 times
-1

PatrikD
- 379
- 4
- 16
-
Show more code. EXC_BAD_ACCESS is a common crash on iOS and gives only very few clues for debugging. – rdurand Nov 14 '14 at 14:27
-
If I had to guess, I'd say you've lost your reference to the object that used to be held in `payment`. You're going to need to provide more context, though. – Ian MacDonald Nov 14 '14 at 14:39
-
also enable zombie mode for debugging.It looks like the object is released but still – rahulinaction Nov 14 '14 at 16:39
-
Sorry guys for little information. I uploaded code http://pastebin.com/kTL8ZRqS – PatrikD Nov 14 '14 at 17:04
-
Please provide the relevant code in the post, not by linking to it. You can [edit] your post by using the link below the question's tags. – gunr2171 Nov 14 '14 at 20:02
1 Answers
1
You're providing too little information. Still...
Are you setting payment
?
SKPayment *payment = [SKPayment paymentWithProduct:product];
Does product
exists and is type SKProduct
?
Also you can't create a SKProduct. SKProducts come as a request response. Check your delegate method productsRequest:didReceiveResponse:
.
You should debug the whole process by setting breakpoints. Then you will be able to provide more information in case you don't resolve the issue by yourself.

Leandro Fournier
- 927
- 1
- 9
- 21
-
I am sorry for little information I upload full code of in-app and product is type SKProduct and it exists. http://pastebin.com/kTL8ZRqS – PatrikD Nov 14 '14 at 17:03
-
I'm looking at your code. This won't resolve your issue but you should set the in-app purchase observer in a more general class, one that can be accessible all the time (your application delegate class, for example); otherwise, if for some reason the app crashes during download, the product won't be delivered. Besides you don't have to set the observer multiple times. Apart from this, did you notice that buyPackage always buy the same product ([validProducts objectAtIndex:0])? If you did so for testing purposes, does validProducts is different from nil? – Leandro Fournier Nov 14 '14 at 19:54
-
Problem was that I dont free memory `[[SKPaymentQueue defaultQueue] removeTransactionObserver:self];` – PatrikD Nov 16 '14 at 08:12