[英]Running a project build in iOS5/xcode 4.2 on iOS simulator 4.2/xcode3.2.5
I had created a project using base sdk 5.0 in xcode 4.2. 我在xcode 4.2中使用基本sdk 5.0创建了一个项目。 While creating the project, I had not checked all 3 options that are displayed, when we create the new project on iOS 5.0, namely.
创建项目时,在iOS 5.0上创建新项目时,我没有检查显示的所有3个选项。 storyboard, use ARC and include unit tests.
故事板,使用ARC并包含单元测试。 After writing my code, I want to run this on xcode 3.2.5/ iOS 4.2, but it gives an error because iOS 5 uses @autoreleasepool instead of NSAutoreleasePool.
编写我的代码后,我想在xcode 3.2.5 / iOS 4.2上运行它,但是由于iOS 5使用@autoreleasepool而不是NSAutoreleasePool导致了错误。 How will I run it on iOS4.2
我将如何在iOS4.2上运行它
How about using the old main.m? 使用旧的main.m怎么样?
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
Another thing. 另一件事。 "storyboards" and "ARC" are only supported in iOS 5. So this will be a problem too if you want to run this in iOS4.
仅iOS 5支持“ storyboards”和“ ARC”。因此,如果要在iOS4中运行它,这也将成为问题。
summary: if u want backward compatibility write your program on the lowest version you want to support and it will be fine. 摘要:如果您想向后兼容,请在要支持的最低版本上编写程序,这很好。 use old main.m, retain instead of strong and no storyboards or ARC and it works on iOS >= 4.
使用旧的main.m,保留而不是使用坚固,没有情节提要或ARC,并且可以在iOS> = 4上运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.