SIGN UP

VIMessengerCompletion

Interface that represents a completion handler that is used to get results of methods such as [VIConversation update:], [VIMessenger getUserByName:completion:], etc.

A queue on which all events will be received is specified via [VIClient initWithDelegateQueue:].

Methods(1)

Methods

success:failure:

+ (instancetype)success:(void (^) ( ObjectType result ))success
                failure:(void (^) ( VIErrorEvent *errorEvent ))failure

Creates completion handler.

Parameters

  • success:

    void (^) ( ObjectType result )

    Invoked when a method call with the specified completion handler is successfully completed. ObjectType depends on the called method, e.g., it will be VIUserEvent if [VIMessenger getUserByIMId:completion:] is called.

    [messenger getUserByIMId:@42
                 completion:[VIMessengerCompletion
                         success:^(VIUserEvent *event) {
                             NSLog(@"User: %@", event.user.displayName);
                         } failure:^(VIErrorEvent *event) {
                             NSLog(@"Error: %@", event.errorDescription);
                         }]];
  • failure:

    void (^) ( VIErrorEvent *errorEvent )

    Invoked when an error occurred as the method call result with the specified completion handler.

Returns

  • Return:

    instancetype

    Completion handler