ioswatchkitwkinterfaceobject

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?


Solution

  • 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.