问题与'强'属性有关

Rev*_*air 0 objective-c

我正在努力学习Objective-C.所以我刚刚实现了一个ProfileViewController,这是我的头文件:

#import <UIKit/UIKit.h>

@interface ProfileViewController : UIViewController

@property (strong, nonatomic) UIScrollView *scrollView;//strong is not colored by XCode

@end
Run Code Online (Sandbox Code Playgroud)

但我对该@property行有以下错误,我完全坚持下去:

No 'assign', 'retain' or 'copy' attribute is specified - 'assign' is assumed
Default property 'assign' not appropriate for non-gc object
Run Code Online (Sandbox Code Playgroud)

在我的ProfileViewController.m我有以下警告:Property 'scrollView' needssetScrollViewneed 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)
Run Code Online (Sandbox Code Playgroud)

Mar*_*n R 7

强属性是ARC(自动引用计数)的一个特性,自Xcode 4.2(LLVM编译器3.0)以来可用,比较https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html.