Instance Method

inSessionWithError:executeBlock:

Synchronously begins a session, executes the given block, and ends the session.

Declaration

- (BOOL)inSessionWithError:(NSError * _Nullable *)error executeBlock:(BOOL (^)(NSError * _Nullable *error))block;

Parameters

error

On return, if an error occurred when attempting to create a session or execute the block, contains details about the error.

block

A block to be called in the context of the created session. This block returns a Boolean value indicating whether communication was successful.

error

To indicate that an error occurred during the session, populate this with an NSError object containing details and return NO.

Return Value

YES if the session was successfully created and the specified block returns YES; otherwise, NO.