Here is the situation. I created a project in xcode 4.2 with deployment target set as 5.0. but I want to give backward compatibility to my code till 4.0. Now I dont have simulators for 4.2 or 4.0 in xcode 4.2, so i run my code in xcode 4.0. Here I got two errors:
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;
This is what we generally wrote in main.h before ARC or iOS5
Now another problem which I encountered was that main.h was getting called but AppDelegate was not getting called i.e aplicationDidFinishLaunching was never called. Then I modified the above code to something like this
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass(AppDelegate.class));
[pool release];
return retVal;
Now, I got no problem and the build was successful and it gets compiled in both versions of xcode. I just want to know that why did this happen and is it OK for me to continue with my project with above written main definition in xcode 4.2, because it doesn’t seem good to me.
Try this. That should answer your question.
Basically you need to aim for iOS4 first, and it should work with iOS5. The problem is when you start with iOS5 first, because iOS4 doesn’t know the new features. It may seem as a pain, but consider if it is necessary to support iOS4, we have iOS6 now and iOS5 is a majority among all versions…