-1

Why after updating to iOS 9 does this line of code not work?

The warning is Undeclared selector 'performThisMethod:_ImageData

The app crashes on the [self performSelector:]

[self performSelector:@selector(performThisMethod:_ImageData:)withObject:nil afterDelay:0.05f];

-(void) performThisMethod : (NSData *) data {
     NSLog(@"Testing this Method");

  }

What has Apple changed?

Ryan Bemrose
  • 8,538
  • 37
  • 51

2 Answers2

1

You are using performSelector incorrectly. You want:

[self performSelector:@selector(performThisMethod:) withObject:_ImageData afterDelay:0.05f];

Better yet, use dispatch_after:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    [self performThisMethod:_ImageData];
});
rmaddy
  • 307,833
  • 40
  • 508
  • 550
  • 1
    Glad I could help. Please don't forget to accept an answer that solved your issue. This indicates the question is complete and it increases your reputation. – rmaddy Oct 17 '15 at 17:48
0

Your code should probably be

[self performSelector:@selector(performThisMethod:) withObject:_ImageData afterDelay:0.05f];

Take a look at this question answers to better understand the performSelector behaviour.

Community
  • 1
  • 1
luk2302
  • 50,400
  • 22
  • 92
  • 131