steps to fix a project that won't compile
Pulling my hair out in trying to get a simple window based project to compile.
I am running both 3.2.2 and 3.2.3 versions of Xcode. The latter is set up in a separate folder.
Originally I used the latter to create and compile my project against the new 4.0 sdk. It compiled fine. Then I made the mistake of deleting some sdks I thought I no longer needed.
Ever since I can no longer compile.
Right now I get a dozen or so errors similar to the following "_OBJC_CLASS_$_CATransition", referenced from: objc-class-ref-to-CATransition in ViewTransitionsAppDelegate.o
My active executable is the iphone simulator 4 and Base SDK is iPhone device 3.0.
I tried reinstalling the xcode3.2.3 installer, no difference.
I'm totally stymied, as my project WAS working and compiling fine, both to the simulator and external device.
Are there 开发者_如何学Pythonany best practices or recommended steps in fixing or rebuilding a project when it won't compile?
Any help welcome!
Make sure that your application is linked against QuartzCore.framework
and that you're importing the CoreAnimation headers wherever you use CATransition:
#import <QuartzCore/CoreAnimation.h>
Otherwise, I'd recommend completely deleting all installations of Xcode/Dev Tools from your system (do a thorough clean) and reinstall the latest SDK.
EDIT: Also forgot to mention that the latest iPhone SDK (iOS 4), at least for me, does not include previous versions of the iPhone SDK. It only includes the 3.2 and 4.0 SDKs, so you will have to edit the target/project settings of your app to use iPhone SDK 4.0.
Just as a note - I struggled with this for a bit, and found it was because I hadn't imported the "QuartzCore" framework into my project.
HTH.
CATransition is probably not available in the older version of the OS (pre-4.0). You basically have 3 choices:
1) Rewrite the portions dealing with CATransition to not use it (or anything else not available to pre-4.0 iOS versions)
2) Write code that, either at compilation time or runtime, chooses the correct behavior to either use CATransitions or disable the feature, or to implement it differently (see Apple's iPad development guide -- it shows a very useful technique involving NSClassFromString)
3) Target the later OS
You'll probably want to go with #3
精彩评论