【发布时间】:2011-09-02 20:10:54
【问题描述】:
编译此代码时,我收到错误“初始化程序元素不是编译时常量”。谁能解释一下为什么?
#import "PreferencesController.h"
@implementation PreferencesController
- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
}
return self;
}
NSImage* imageSegment = [[NSImage alloc] initWithContentsOfFile:@"/User/asd.jpg"];//error here
【问题讨论】:
标签: objective-c cocoa initialization compiler-errors global-variables