Search code examples
uber-api

How to detect when user click Uber Button (UBSDKRideRequestButton)


Is there anyway to detect if user clicks the uber button ?

// initialize uber request button
if (!_rideRequestButton) {
    _rideRequestButton = [[UBSDKRideRequestButton alloc] initWithClient:self.ridesClient];
    _rideRequestButton.delegate = self;

}

enter image description here


Solution

  • I found that I can add a target action to the button

     [_rideRequestButton addTarget:self
                                   action:@selector(rideRequestButtonIsTapped:)
                         forControlEvents:UIControlEventTouchUpInside];
    
    - (void)rideRequestButtonIsTapped:(UBSDKRideRequestButton *)button
    

    This approach is also recommend by uber:

    https://github.com/uber/rides-ios-sdk/issues/66