ARC Errors with PhoneGap Plugins

If you have used a few PhoneGap plugins, you might have received this error from time to time

ARC forbids explicit message send of ‘retain’ issue

At first, the natural reaction is “OH yeah! I remember fixing that about 6 months ago”. Now how did I do that again?

ARC or Automatic Reference Counting was implemented in iOS 5 and beyond to help developers deal with memory management. Sometimes when an older piece of code is used, in this case a PhoneGap plugin, the developer may choose to manage memory in a way consistent with the pre ARC style. Thus the cryptic error above. Luckily, it’s a pretty easy fix. Any files that are giving these errors, you can set the Compiler Flag to -fno-objc-arc in the Build Phases => Compilier Sources settings.

Screen Shot 2013-09-23 at 2.21.14 PM

Confused? In the example above InAppPurchase.m and SKProduct+LocalizedPrice.m are older files that need to be compiled with the flag above.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *