Jump to content
  • Advertisement
Sign in to follow this  
blueshogun96

Gesture recognition causes my app to crash.

This topic is 1419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm still pretty new to gesture recognition, and I've never needed it until now.  So, I've found various examples on the net, and when I try to implement it, my app just crashes when I touch the screen.  So anyway, this is what I did.

 

I added this to viewDidLoad

// Create and initialize a tap gesture
    UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc]
                                             initWithTarget:self action:@selector(respondToTapGesture:)];
    
    // Specify that the gesture must be a single tap
    tapRecognizer.numberOfTapsRequired = 1;
    
    // Add the tap gesture recognizer to the view
    [self.view addGestureRecognizer:tapRecognizer];

Then I added this to the ViewController

- (void)respondToTapGesture:(UIGestureRecognizer *)gesture
{
    // Do whatever
}

What happens is I get a crash.  More specifically, I get an EXC_BAD_ACCESS.

 

[attachment=23338:Screen Shot 2014-08-27 at 9.11.42 AM.png]

 

That's the stack trace, if that helps.  I have absolutely no idea why this isn't working, when all of the examples appear to be working fine.  Did I forget to add something to plist?

 

Shogun.

Share this post


Link to post
Share on other sites
Advertisement

Ensure that your device is running iOS 3.2 or greater.


L. Spiro

 

My device is running iOS 7.1.2.  Since our last topic we've engaged regarding iOS devices, I've gotten my hands on a more modern iPhone.

 

Shogun.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!