0

I'm trying to run xCode 4.2 using an iPhone 3.1.3. My quick question is:

  • Is there a workaround to make this function work?

    UITapGestureRecognizer *gestureSingleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didSingleTap:)];
    [gestureSingleTap setNumberOfTapsRequired:1];
    [taskScrollView addGestureRecognizer:gestureSingleTap];
    [gestureSingleTap release];    
    
  • The error I'm getting at run-time is this:

    -[UITapGestureRecognizer setNumberOfTapsRequired:]: unrecognized selector sent to instance 0x143170
    

My questions:

  • Is there a workaround for this on iOS3.1.3 that is simple and does not require a large amount of code rewrite?
  • Can the function be "extended" in some way to redirect to a 3.1.3 equivalent for backwards compatibility?

Many thanks!

Added note: found out some functions are considered "private" and not fully functional before their actual releases. This is probably my core issue. If anyone has a backwards compatibility library, I'd be interested to use that.

BoxCat
  • 77
  • 10
  • Added note: I did a lot of digging. Looks like 3.1.3 is not considered iOS 3.2. The basic functions are these for 3.1.3 but are considered "undocumented features" by apple in 3.1.3. They made the full introduction in iOS 3.2. – BoxCat Feb 06 '12 at 20:02
  • I'm going to leave the question open because there might be an way around this or a class extension that completes the missing functionality in 3.1.3. Very interested in backwards extending classes such as UITapGestureRecognizer+3.1.3compatibility.h – BoxCat Feb 06 '12 at 20:04
  • My workaround at the moment is to downgrade my xCode to 4.0.2 using a iPhone 3G (4.2.1) for development instead of an iPhone 2G (3.1.3). – BoxCat Feb 06 '12 at 20:05

1 Answers1

0

Look at the method didSingleTap:

Does it really have a semicolon after it and take an argument? (also is it spelled correctly, and does your class actually define this method?)

If didSingleTap doesn't take arguments, it should be @selector(didSingleTap) (without the colon after didSingleTap).

Update: previous answer was wrong. Properties define set/get methods.

Michael Chinen
  • 17,737
  • 5
  • 33
  • 45
  • Hi Michael, Thanks but it's still throwing the same error. I believe the property is internally translating it to "setNumberOfTapsRequired". Here the new code: gestureSingleTap.numberOfTapsRequired = 1; Here's the error: -[UITapGestureRecognizer setNumberOfTapsRequired:]: unrecognized selector sent to instance – BoxCat Feb 05 '12 at 22:16
  • Okay, I updated my answer. I now realize the unrecognized selector is not setNumberOfTapsRequired. – Michael Chinen Feb 06 '12 at 00:39