TS.xy
TS.xy

Reputation: 1234

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

Upvotes: 0

Views: 149

Answers (2)

TS.xy
TS.xy

Reputation: 1234

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

Upvotes: 2

Dustin Whittle
Dustin Whittle

Reputation: 1252

You can listen for when the user requests a ride using the button by using callbacks:

https://developer.uber.com/docs/riders/ride-requests/tutorials/button/ios#handle-callbacks-for-rides

Upvotes: 0

Related Questions