Reputation: 2421
I'm trying to learn Objective-C. So I've just implemented a ProfileViewController and here is my header file:
#import <UIKit/UIKit.h>
@interface ProfileViewController : UIViewController
@property (strong, nonatomic) UIScrollView *scrollView;//strong is not colored by XCode
@end
But I have the following error with the @property
line and I'm completely stuck with it :
No 'assign', 'retain' or 'copy' attribute is specified - 'assign' is assumed
Default property 'assign' not appropriate for non-gc object
And in my ProfileViewController.m
I have the following warning : Property 'scrollView' needs
setScrollView need to be defined
Developer Information:
Version: 4.1 (4B110)
Location: /Developer
Applications:
Xcode: 4.1 (516)
Instruments: 4.1 (4138)
Dashcode: 3.0.2 (336)
SDKs:
Mac OS X:
10,6: (10J567)
10,7: (11A511a)
iPhone OS:
4,3: (8H7)
iPhone Simulator:
4,3: (8H7)
Upvotes: 0
Views: 519
Reputation: 920
Are you actually using ARC ? Did you tick-marked the checkbox 'use automatic reference counting' while creating the project ? If you use older version of XCode, then you will not get such options as it does not support ARC. In that case, either update your xcode or continue without ARC using manual memory management and keywords such as 'assign/nonassign' instead of 'strong/weak' ...
Upvotes: 0
Reputation: 539685
Strong properties are a feature of ARC (automatic reference counting) which is available since Xcode 4.2 (LLVM compiler 3.0), compare https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html.
Upvotes: 7