In App Purchase Crashes on [[SKPaymentQueue defaultQueue] addPayment:payment]

The error message indicates a message is being sent to a deallocated instance of InAppPurchaseManager, which is your class. And it’s happening after you open the view (creating an instance), close the view (releasing an instance), then opening the view again (creating a second instance). And the problem is happening within the addPayment: call. This … Read more

What is NSZombie?

It’s a memory debugging aid. Specifically, when you set NSZombieEnabled then whenever an object reaches retain count 0, rather than being deallocated it morphs itself into an NSZombie instance. Whenever such a zombie receives a message, it logs a warning rather than crashing or behaving in an unpredictable way. As such, you can debug subtle … Read more

How to enable NSZombie in Xcode?

Environment variables are now part of the “scheme”. To edit the scheme and turn on zombies: In the “Product” menu, select “Edit Scheme”. Go to the “Run Foo.app” stage in the left panel, and the “Arguments” tab on the right. Add NSZombieEnabled to the “Environment Variables” section and set the value to YES, as you … Read more

How do I set up NSZombieEnabled in Xcode 4?

In Xcode 4.x press ⌥⌘R (or click Menubar > Product > Scheme > Edit Scheme) select the “Diagnostics” tab and click “Enable Zombie Objects”: This turns released objects into NSZombie instances that print console warnings when used again. This is a debugging aid that increases memory use (no object is really released) but improves error … Read more