1

When I try to dismiss a UIImageView with

- (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer {
    CGPoint p = [gestureRecognizer locationInView:self.view];
    if (CGRectContainsPoint(_tutorial.frame, p)) {
        _tutorial.hidden = YES;

        _transButton.enabled = YES;
        _transButtonEng.enabled = YES;
        _infoButton.enabled = YES;
        _textfield.enabled = YES;
    }
    else {
        NSLog(@"HOW IS THIS EVEN POSSIBLE?!?!?"); //The CGRect is the whole screen
    }
}

I get this error message:

MacBook-Pro.local APP_NAME[97086] : CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

It also repeats the same message with CGContextSetFillColorWithColor: replaced by:

CGContextSetStrokeColorWithColor:
CGContextSaveGState:
CGContextSetFlatness:
CGContextAddPath:
CGContextDrawPath:
CGContextRestoreGState:
CGContextSaveGState:
CGContextSetFlatness:
CGContextAddPath:
CGContextDrawPath:
CGContextRestoreGState:
CGContextSetFillColorWithColor:
CGContextSetStrokeColorWithColor:
CGContextSetFillColorWithColor:
CGContextSetStrokeColorWithColor:
CGContextGetBlendMode:
CGContextSetBlendMode:
CGContextFillRects:
CGContextSetBlendMode:
CGContextSetFillColorWithColor:
CGContextSetStrokeColorWithColor:
CGContextGetBlendMode:
CGContextSetBlendMode:
CGContextFillRects:
CGContextSetBlendMode:
CGContextSetFillColorWithColor:
CGContextSetStrokeColorWithColor:
CGContextGetBlendMode:
CGContextSetBlendMode:
CGContextFillRects:
CGContextSetBlendMode:

I am using the latest version of Xcode 5 and iOS 7.0.3.

How would I fix these errors?

juniperi
  • 3,723
  • 1
  • 23
  • 30
ZuluDeltaNiner
  • 725
  • 2
  • 11
  • 27
  • In the code that you've copied to your question, you should also include the method / function that has the call to "`CGContextSetFillColorWithColor`". – Michael Dautermann Nov 18 '13 at 01:58
  • @MichaelDautermann I don't call any of these anywhere; I use Interface Builder – ZuluDeltaNiner Nov 18 '13 at 02:02
  • I don't know if it's related, but there are known iOS 7 bugs that cause this sort of behavior: http://stackoverflow.com/questions/19599266/invalid-context-0x0-under-ios-7-0-and-system-degradation/19599686#19599686 – Rob Nov 18 '13 at 05:12
  • I have seen these, but I was wondering if there was a fix for when UIGestureRecognizer/UIImageView cause the errors – ZuluDeltaNiner Nov 18 '13 at 05:25

1 Answers1

1

After you hide your _tutorial imageView, you should remove the gesture recognizer (via UIGestureRecgonizer's "removeTarget: action:" API, so that way you won't be calling "CGRectContainsPoint" on a hidden view with who knows what for frame values.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215