Agora RTC Objective-C API Reference Refactor

Instance Methods
AgoraRtmLock Class Reference

Inherits <NSObject>.

## Instance Methods
(void) | - setLock:channelType:lockName:ttl:completion:
(void) | - removeLock:channelType:lockName:completion:
(void) | - acquireLock:channelType:lockName:retry:completion:
(void) | - releaseLock:channelType:lockName:completion:
(void) | - revokeLock:channelType:lockName:userId:completion:
(void) | - getLocks:channelType:completion:

## Method Documentation

## ◆ NS_UNAVAILABLE

- (instancetype _Nullable) NS_UNAVAILABLE |  |  |

## ◆ setLock:channelType:lockName:ttl:completion:

- (void) setLock: |  | (NSString *_Nonnull) | channelName
channelType: |  | (AgoraRtmChannelType) | channelType
lockName: |  | (NSString *_Nonnull) | lockName
ttl: |  | (int) | ttl
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

sets a lock

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  ttl | The lock ttl.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ removeLock:channelType:lockName:completion:

- (void) removeLock: |  | (NSString *_Nonnull) | channelName
channelType: |  | (AgoraRtmChannelType) | channelType
lockName: |  | (NSString *_Nonnull) | lockName
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

removes a lock

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ acquireLock:channelType:lockName:retry:completion:

- (void) acquireLock: |  | (NSString *_Nonnull) | channelName
channelType: |  | (AgoraRtmChannelType) | channelType
lockName: |  | (NSString *_Nonnull) | lockName
retry: |  | (BOOL) | retry
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

acquires a lock

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  retry | Whether to automatic retry when acquires lock failed
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ releaseLock:channelType:lockName:completion:

- (void) releaseLock: |  | (NSString *_Nonnull) | channelName
channelType: |  | (AgoraRtmChannelType) | channelType
lockName: |  | (NSString *_Nonnull) | lockName
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

releases a lock

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ revokeLock:channelType:lockName:userId:completion:

- (void) revokeLock: |  | (NSString *_Nonnull) | channelName
channelType: |  | (AgoraRtmChannelType) | channelType
lockName: |  | (NSString *_Nonnull) | lockName
userId: |  | (NSString *_Nonnull) | userId
completion: |  | (AgoraRtmOperationBlock _Nullable) | completionBlock

disables a lock

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  owner | The lock owner.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.

## ◆ getLocks:channelType:completion:

- (void) getLocks: |  | (NSString *_Nonnull) | channelName
channelType: |  | (AgoraRtmChannelType) | channelType
completion: |  | (AgoraRtmGetLocksBlock _Nullable) | completionBlock

gets locks in the channel

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  completionBlock | The operation result will be notified by completionBlock, if operation success，will given a not nil response and nil errorInfo，if operation failed，will given a nil response and not nil errorInfo.