在Objective C中定义私有的成员变量

使用了LLVM以后,终于可以定义私有的成员变量了。

@interface RadioViewController ()
{
@private
    UIBackgroundTaskIdentifier task;
}

@property (strong, nonatomic) AVPlayer *audioPlayer;

@end

请注意,在m文件的categories需要使用花括号({})@property还是需要定义在花括号的外面。

这样在

@implementation RadioViewController

@end

中间就可以自由的使用这个成员变量(field)task了。