使用了LLVM以后,終於可以定義私有的成員變量了。
@interface RadioViewController () { @private UIBackgroundTaskIdentifier task; } @property (strong, nonatomic) AVPlayer *audioPlayer; @end
請注意,在m文件的categories需要使用花括號({})@property還是需要定義在花括號的外面。
這樣在
@implementation RadioViewController
@end
中間就可以自由的使用這個成員變量(field)task了。