1
votes

I'm implementing my first iOS 5.1 application using XCode 4.3.2 and I'm experimenting a strange XCode interface builder behavior.

I created a ViewController with NIB file in the interface builder and when connecting any UI object to the ViewController .h in order to create the IBOutlet properties, the dialog windows to set the outlet properties doesn't show the Storage field.

To be clear, the interface builder show this dialog:

Screenshot 1

instead of this one:

Screenshot 2

Consequently, the code generated by the interface builder is like the following:

@property (unsafe_unretained, nonatomic) IBOutlet UILabel *labelName;

while the code I'm expecting is:

@property (weak, nonatomic) IBOutlet UILabel *labelName;

This behavior starts to occurs from a couple of days and just for one project, so my suspicious is that I accidentally changed some project setting.

Any help to restore the XCode Interface Builder behaviour in order to generate ARC code?

Thanks in advance.

2
They're both the same. And besides, it seems right to me... what's the problem here? - CodaFi
It looks right apart from UILabel rather than UILabel*. - mattjgalloway
@mattjgalloway you're right, I corrected the code - massyc
What am I missing? Both lines are identical. - Abizern
Both of those lines are the same. > This behavior starts to occurs from a couple of days and just for one project, so my suspicious is that I accidentally changed some project setting. Run a diff against an earlier version, it will show you what has changed. - Jim

2 Answers

0
votes

I bet your target is 4.x right? In that case you can't use weak and so it uses unsafe_unretained. They're the same thing except unsafe_unretained does not automatically nil the pointer for you but that doesn't particularly matter for your use case.

0
votes

You probably switched off the ARC on your project/target settings. Switch to Yes and you'll get back the Storage field.

enter image description here