Solved

Property/Synthesize difference between debug and release

Posted on 2010-08-12
3
1,209 Views
Last Modified: 2013-12-26
I'm declaring a property in my *.h file:

@property NSString * URL;

I add a "Synthesize" in my *.m file:

@synthesize URL;

Building and running in debug works fine. Making use of it and it seems healthy. Building release mode yields an error:  synthesized property 'URL' must either be named the same as a compatible ivar or must explicitly name an ivar

what am I doing wrong?



0
Comment
Question by:ronenmagid1
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 500 total points
ID: 33423139
Seems like you make programs for Mac OS X and not for iPhone. I'm really glad. :)

You wrote:
@property NSString * URL;

so everything is by default: readwrite and assing are the attributes, the setter and the getter will be generated and will have URL and setURL names.
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocProperties.html#//apple_ref/doc/uid/TP30001163-CH17-SW2

For NSString, I'd use retain or copy, but not assign. At least it is so for a common case.

The answer: the release configuration is 32-bit. The debug is 64 bit and so you can declare the property (it works so since Xcode 3.2.2?). For the 32-bit version we have to declare a variable and then the property. So for a test,  add NSString* URL into the class. If the project will be compiled in debug and release, so I'm right.
 
0
 

Author Closing Comment

by:ronenmagid1
ID: 33423242
yep. thanks!
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33423298
You are welcome.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now