这里是情况。我在xcode 4.2中创建了一个项目,部署目标设置为5.0。但我想给我的代码向后兼容到4.0。现在我没有4.2或4.0在xcode 4.2模拟器,所以我运行我的代码在xcode 4.0。在这里,我得到了两个错误:运行在xcode 4.0(部署目标4.0)中的xcode 4.2(部署目标5.0)中创建的项目
1. unknown "strong". I removed it by adding retain instead.
2. unknown "@" in project, so I added below code in main.h
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
这就是我们通常在main.h写道ARC或iOS5的
之前,现在我遇到的是main.h渐渐叫,但AppDelegate中没有得到另一个问题称为即aplicationDidFinishLaunching从未被调用。然后我修改了上面的代码是这样的
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass(AppDelegate.class));
[pool release];
return retVal;
现在,我没有问题,构建是成功的,它得到在Xcode的两个版本编译。我只是想知道为什么会发生这种情况,并且可以继续使用xcode 4.2中的上述主要定义继续我的项目,因为它对我来说似乎并不好。