quantumpotato
quantumpotato

Reputation: 9767

WKInterfaceButton IBAction is sending nil sender

2015-05-02 23:56:34.047 TapIt WatchKit Extension[1398:18615] b: <WKInterfaceButton: 0x6080000580c0>
2015-05-02 23:56:34.048 TapIt WatchKit Extension[1398:18615] sender: (null)

- (IBAction)tapped:(id)sender {
    bool success = false;
    NSLog(@"b: %@", b);
    NSLog(@"sender: %@", sender);

Why is this coming through nil?

Upvotes: 1

Views: 513

Answers (1)

Mike Swanson
Mike Swanson

Reputation: 3347

WatchKit actions don't include the sender as an argument. That's why you're seeing nil. In this case, your method should really just be - (IBAction)tapped.

Upvotes: 8

Related Questions