I am new to iPhone development. I started developing a project using iOS4.2 SDK. It works properly on both an iOS4.2 device and simulator. Later I realized that my app wasn't working on devices with iOS3.1.3. To solve this I updated the "Deployment Target" in my app's configuration file to "3.1.3".
The problem I am having is that I use UITapGestureRecognizer in some of my classes. On compiling my code using iOS 3.1.3 SDK I get the following errors:
error: 'UITapGestureRecognizer' undeclared (first use in this function)
error: 'tap' undeclared (first use in this function)
From what I have ready, this seems to be because iOS .1.3 does not support UITapGestureRecognizer, so to run this i made the following changes wherever I use UITapGestureRecognizer:
Class mailClass = (NSClassFromString(@"UITapGestureRecognizer"));
if(mailClass != nil)
{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(findOutTheTagmap:)];
[imageView addGestureRecognizer:tap];
[tap release];
}
I also updated my Target configuration and set the UIKit Framework to "Weak". Additionally I have also made the following changes: Base SDK: 3.1.3 Compiler Version: GCC4.2 (also tried with GCC4.0) Mac OS X Deployment Target: Compiler Default (also tried with 10.4 and 10.6) iOS Deployment Target: 3.1.3
Yet, when I try compiling my code, I am still shown the same errors. What is surprising is that a few days ago someone was helping me and this worked.
I have tried pretty much everything I have found in forums.
Does anyone have an idea on how I can proceed?
Thanks in advance!
Setting a different SDK as you've done can be useful for getting hard errors about what you can't use, but as you can see it's difficult to impossible (depending on the class) to work around.
Instead, you should always be building against the latest SDK. (In fact, newer versions of Xcode have a "latest" setting you should use.) Set iOS Deployment Target (IPHONEOS_DEPLOYMENT_TARGET) to your minimum version.