Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App crash on [[SKPaymentQueue defaultQueue] addTransactionObserver:observer];

not much report on the crash

That's all I can get from the crash when I do in the applicationDidBecomeActive

MyStoreObserver * observer = [[MyStoreObserver alloc] initWithContext:self.managedObjectContext andDelegate:self];

[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];

But the weird thing is I have been able to purchase twice in the past and even if I delete the app re-reun everything I cannot escape this pit. It doesn't seems logic. I can alloc init the observer alone without problem and I can call the default paymentQueue without problem but if I try to add the transaction observer to the queue, life stop. It's on ARC and the delegate I added to the observer is not the problem. I know for sure.

I've added an nslog to every method in the observer and none get called before the crash

SOLUTION FOUND

Okay, well it looks like the observer is not retained by the queue and thus the observer needs to be an instance variable.

Thanks

like image 297
Nicolas Manzini Avatar asked Dec 05 '12 20:12

Nicolas Manzini


1 Answers

Okay, well it looks like the observer is not retained by the queue and thus the observer needs to be an instance variable (or retained in some way).

like image 145
Nicolas Manzini Avatar answered Sep 27 '22 22:09

Nicolas Manzini