sri hs
sri hs

Reputation: 116

Expected property attribute before "strong"

Am a newbie to iOS. Am getting the errors for the @property line,

@property (nonatomic, strong) UITextField *text;

using Xcode 3.2, any help is appreciated.

Upvotes: 1

Views: 209

Answers (4)

Anoop Vaidya
Anoop Vaidya

Reputation: 46533

strong, weak etc are supported in LLVM compilers. And you have Xcode 3.2 mostly running GCC compiler. Hence this token in unrecognized there.

You need to use retain instead of strong. Also if you are using weak replace it with copy.

Also, use weak for Outlets.

GCC remains the default compiler for Xcode 3 but with the release of Xcode 4 the default compiler for new projects has changed to LLVM-GCC.

You can also set the compiler for your Xcode and/or project. For more see Compilers for Xcode.

Upvotes: 0

Amar
Amar

Reputation: 13222

From ARC docs,

ARC is supported in Xcode 4.2 for OS X v10.6 and v10.7 (64-bit applications) and for iOS 4 and iOS 5.

Upgrade your OSX and/or Xcode to latest or use manual memory management instead.

Word of advice: Starting Feb 2014, Apple insists (Read: Make Your Apps Work Seamlessly with iOS 7) that all applications submitted to Appstore must be developed using latest Xcode and optimized for iOS7. Advisable to upgrade your dev environment

Hope that helps!

Upvotes: 1

Mani
Mani

Reputation: 17585

Strong property is related to ARC which is only supported from Xcode 4.2. See this apple's release note.

Update you xcode to this. To convert your project to ARC enable by choose Edit > Refactor > Convert to Objective-C ARC

Note:

ARC is supported in Xcode 4.2 for OS X v10.6 and v10.7 (64-bit applications) and for iOS 4 and iOS 5. Weak references are not supported in OS X v10.6 and iOS 4.

Upvotes: 0

shanegao
shanegao

Reputation: 3592

strong is using in ARC, it's first seen in iOS 5, in Xcode 3.2, you can use retain, or update Xcode.

Upvotes: 1

Related Questions