Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@synthesize of 'weak' property is only allowed in ARC or GC mode with first compile of urbanship

Basically, I have an IOS app that functioned without issue.

While following the instructions at http://docs.urbanairship.com/build/ios.html#ios-push-getting-started, I reached the "Register Your Device" section asking me to compile.

After attempting to build the code in xCode 5 I received the following error "@implementation UAPushSettingsAddTagViewController @synthesize of 'weak' property is only allowed in ARC or GC mode".

Note:ARC mode is not in use.

like image 629
Kmb40 Avatar asked Sep 21 '13 18:09

Kmb40


2 Answers

Search for "weak" in your project code and the libraries you include. Change it to a "assign"

Edit:

As @TaylorHalliday points out in his comment below, my answer was rather incomplete.

Changing weak properties to assign will get rid of compiler errors, but it will potentially cause memory management problems if you don't understand how to use manual reference counting.

Since you're using manual reference counting you will need to go through your code and make sure that you retain objects that you need to persist, and then release all owning references to objects when you are done with them. Explaining the details is beyond the scope of a forum post. I suggest you search on "About Memory Management" in the Xcode help system, and read the entire Advanced Memory Management Guide.

You should probably also run the Analyze tool on your project to look for possible memory management problems.

Better yet, convert your project to use ARC. It's much easier to avoid memory management problems when using ARC.

like image 71
Duncan C Avatar answered Oct 24 '22 21:10

Duncan C


I got same error when I added these two files to my project. My project wasn't enabled for ARC. I had to remove these files first and then had to convert my project to ARC. Then adding these files caused no error.

like image 1
zeeawan Avatar answered Oct 24 '22 23:10

zeeawan