Agora Objective-C API Reference for iOS/macOS

AgoraErrorCode Constants Reference

Declared in AgoraEnumerates.h

AgoraErrorCode

Error code.

Error codes occur when the SDK encounters an error that cannot be recovered automatically without any app intervention. For example, the SDK reports the AgoraErrorCodeStartCall = 1002 error if it fails to start a call, and reminds the user to call the leaveChannel method.

Definition

typedef NS_ENUM(NSInteger, AgoraErrorCode ) {
   AgoraErrorCodeNoError = 0,
   AgoraErrorCodeFailed = 1,
   AgoraErrorCodeInvalidArgument = 2,
   AgoraErrorCodeNotReady = 3,
   AgoraErrorCodeNotSupported = 4,
   AgoraErrorCodeRefused = 5,
   AgoraErrorCodeBufferTooSmall = 6,
   AgoraErrorCodeNotInitialized = 7,
   AgoraErrorCodeNoPermission = 9,
   AgoraErrorCodeTimedOut = 10,
   AgoraErrorCodeCanceled = 11,
   AgoraErrorCodeTooOften = 12,
   AgoraErrorCodeBindSocket = 13,
   AgoraErrorCodeNetDown = 14,
   AgoraErrorCodeNoBufs = 15,
   AgoraErrorCodeJoinChannelRejected = 17,
   AgoraErrorCodeLeaveChannelRejected = 18,
   AgoraErrorCodeAlreadyInUse = 19,
   AgoraErrorCodeAbort = 20,
   AgoraErrorCodeInitNetEngine = 21,
   AgoraErrorCodeResourceLimited = 22,
   AgoraErrorCodeInvalidAppId = 101,
   AgoraErrorCodeInvalidChannelId = 102,
   AgoraErrorCodeTokenExpired = 109,
   AgoraErrorCodeInvalidToken = 110,
   AgoraErrorCodeConnectionInterrupted = 111,
   AgoraErrorCodeConnectionLost = 112,
   AgoraErrorCodeNotInChannel = 113,
   AgoraErrorCodeSizeTooLarge = 114,
   AgoraErrorCodeBitrateLimit = 115,
   AgoraErrorCodeTooManyDataStreams = 116,
   AgoraErrorCodeDecryptionFailed = 120,
   AgoraErrorCodeWatermarkParam = 124,
   AgoraErrorCodeWatermarkPath = 125,
   AgoraErrorCodeWatermarkPng = 126,
   AgoraErrorCodeWatermarkInfo = 127,
   AgoraErrorCodeWatermarkAGRB = 128,
   AgoraErrorCodeWatermarkRead = 129,
   AgoraErrorCodeEncryptedStreamNotAllowedPublish = 130,
   AgoraErrorCodeInvalidUserAccount = 134,
   AgoraErrorCodePublishStreamCDNError = 151,
   AgoraErrorCodePublishStreamNumReachLimit = 152,
   AgoraErrorCodePublishStreamNotAuthorized = 153,
   AgoraErrorCodePublishStreamInternalServerError = 154,
   AgoraErrorCodePublishStreamNotFound = 155,
   AgoraErrorCodePublishStreamFormatNotSuppported = 156,
   AgoraErrorCodeLoadMediaEngine = 1001,
   AgoraErrorCodeStartCall = 1002,
   AgoraErrorCodeStartCamera = 1003,
   AgoraErrorCodeStartVideoRender = 1004,
   AgoraErrorCodeAdmGeneralError = 1005,
   AgoraErrorCodeAdmJavaResource = 1006,
   AgoraErrorCodeAdmSampleRate = 1007,
   AgoraErrorCodeAdmInitPlayout = 1008,
   AgoraErrorCodeAdmStartPlayout = 1009,
   AgoraErrorCodeAdmStopPlayout = 1010,
   AgoraErrorCodeAdmInitRecording = 1011,
   AgoraErrorCodeAdmStartRecording = 1012,
   AgoraErrorCodeAdmStopRecording = 1013,
   AgoraErrorCodeAdmRuntimePlayoutError = 1015,
   AgoraErrorCodeAdmRuntimeRecordingError = 1017,
   AgoraErrorCodeAdmRecordAudioFailed = 1018,
   AgoraErrorCodeAdmPlayAbnormalFrequency = 1020,
   AgoraErrorCodeAdmRecordAbnormalFrequency = 1021,
   AgoraErrorCodeAdmInitLoopback = 1022,
   AgoraErrorCodeAdmStartLoopback = 1023,
   AgoraErrorCodeAdmNoPermission = 1027,
   AgoraErrorCodeAdmNoRecordingDevice = 1359,
   AgoraErrorCodeAdmNoPlayoutDevice = 1360,
   AgoraErrorCodeVdmCameraNotAuthorized = 1501,
   AgoraErrorCodeVcmUnknownError = 1600,
   AgoraErrorCodeVcmEncoderInitError = 1601,
   AgoraErrorCodeVcmEncoderEncodeError = 1602,
   AgoraErrorCodeVcmEncoderSetError = 1603,
};

Constants

AgoraErrorCodeNoError

0: No error occurs.

Declared In AgoraEnumerates.h.

AgoraErrorCodeFailed

1: A general error occurs (no specified reason).

Declared In AgoraEnumerates.h.

AgoraErrorCodeInvalidArgument

2: An invalid parameter is used. For example, the specific channel name includes illegal characters.

Declared In AgoraEnumerates.h.

AgoraErrorCodeNotReady

3: The SDK module is not ready.

Possible solutions:

  • Check the audio device.
  • Check the completeness of the app.
  • Re-initialize the SDK.

Declared In AgoraEnumerates.h.

AgoraErrorCodeNotSupported

4: The current state of the SDK does not support this function.

Declared In AgoraEnumerates.h.

AgoraErrorCodeRefused

5: The request is rejected. This is for internal SDK use only, and is not returned to the app through any method or callback.

Declared In AgoraEnumerates.h.

AgoraErrorCodeBufferTooSmall

6: The buffer size is not big enough to store the returned data.

Declared In AgoraEnumerates.h.

AgoraErrorCodeNotInitialized

7: The SDK is not initialized before calling this method.

Declared In AgoraEnumerates.h.

AgoraErrorCodeNoPermission

9: No permission exists. This is for internal SDK use only, and is not returned to the app through any method or callback.

Declared In AgoraEnumerates.h.

AgoraErrorCodeTimedOut

10: An API method timeout occurs. Some API methods require the SDK to return the execution result, and this error occurs if the request takes too long (over 10 seconds) for the SDK to process.

Declared In AgoraEnumerates.h.

AgoraErrorCodeCanceled

11: The request is canceled. This is for internal SDK use only, and is not returned to the app through any method or callback.

Declared In AgoraEnumerates.h.

AgoraErrorCodeTooOften

12: The method is called too often. This is for internal SDK use only, and is not returned to the app through any method or callback.

Declared In AgoraEnumerates.h.

AgoraErrorCodeBindSocket

13: The SDK fails to bind to the network socket. This is for internal SDK use only, and is not returned to the app through any method or callback.

Declared In AgoraEnumerates.h.

AgoraErrorCodeNetDown

14: The network is unavailable. This is for internal SDK use only, and is not returned to the app through any method or callback.

Declared In AgoraEnumerates.h.

AgoraErrorCodeNoBufs

15: No network buffers are available. This is for internal SDK use only, and is not returned to the app through any method or callback.

Declared In AgoraEnumerates.h.

AgoraErrorCodeJoinChannelRejected

17: The request to join the channel is rejected.

Possible reasons are:

  • The user is already in the channel, and still calls the API method to join the channel, for example, joinChannelByToken.
  • The user tries joining the channel during the echo test. Please join the channel after the echo test ends.

Declared In AgoraEnumerates.h.

AgoraErrorCodeLeaveChannelRejected

18: The request to leave the channel is rejected.

Possible reasons are:

  • The user left the channel and still calls the API method to leave the channel, for example, leaveChannel.
  • The user has not joined the channel and calls the API method to leave the channel.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAlreadyInUse

19: The resources are occupied and cannot be used.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAbort

20: The SDK gave up the request due to too many requests.

Declared In AgoraEnumerates.h.

AgoraErrorCodeInitNetEngine

21: In Windows, specific firewall settings cause the SDK to fail to initialize and crash.

Declared In AgoraEnumerates.h.

AgoraErrorCodeResourceLimited

22: The app uses too much of the system resources and the SDK fails to allocate the resources.

Declared In AgoraEnumerates.h.

AgoraErrorCodeInvalidAppId

101: The specified App ID is invalid. Please try to rejoin the channel with a valid App ID.

Declared In AgoraEnumerates.h.

AgoraErrorCodeInvalidChannelId

102: The specified channel name is invalid. Please try to rejoin the channel with a valid channel name.

Declared In AgoraEnumerates.h.

AgoraErrorCodeTokenExpired

109: The token expired.

DEPRECATED as of v2.4.1. Use AgoraConnectionChangedTokenExpired(9) in the reason parameter of connectionChangedToState.

Possible reasons are:

  • Authorized Timestamp expired: The timestamp is represented by the number of seconds elapsed since 1/1/1970. The user can use the token to access the Agora service within five minutes after the token is generated. If the user does not access the Agora service after five minutes, this token is no longer valid.
  • Call Expiration Timestamp expired: The timestamp is the exact time when a user can no longer use the Agora service (for example, when a user is forced to leave an ongoing call). When a value is set for the Call Expiration Timestamp, it does not mean that the token will expire, but that the user will be banned from the channel.

Declared In AgoraEnumerates.h.

AgoraErrorCodeInvalidToken

110: The token is invalid.

DEPRECATED as of v2.4.1. Use AgoraConnectionChangedInvalidToken(8) in the reason parameter of connectionChangedToState.

Possible reasons are:

  • The App Certificate for the project is enabled in Console, but the user is using the App ID. Once the App Certificate is enabled, the user must use a token.
  • The uid is mandatory, and users must set the same uid as the one set in the joinChannelByToken method.

Declared In AgoraEnumerates.h.

AgoraErrorCodeConnectionInterrupted

111: The Internet connection is interrupted. This applies to the Agora Web SDK only.

Declared In AgoraEnumerates.h.

AgoraErrorCodeConnectionLost

112: The Internet connection is lost. This applies to the Agora Web SDK only.

Declared In AgoraEnumerates.h.

AgoraErrorCodeNotInChannel

113: The user is not in the channel when calling the sendStreamMessage or getUserInfoByUserAccount method.

Declared In AgoraEnumerates.h.

AgoraErrorCodeSizeTooLarge

114: The size of the sent data is over 1024 bytes when the user calls the sendStreamMessage method.

Declared In AgoraEnumerates.h.

AgoraErrorCodeBitrateLimit

115: The bitrate of the sent data exceeds the limit of 6 Kbps when the user calls the sendStreamMessage method.

Declared In AgoraEnumerates.h.

AgoraErrorCodeTooManyDataStreams

116: Too many data streams (over five streams) are created when the user calls the createDataStream method.

Declared In AgoraEnumerates.h.

AgoraErrorCodeDecryptionFailed

120: Decryption fails. The user may have used a different encryption password to join the channel. Check your settings or try rejoining the channel.

Declared In AgoraEnumerates.h.

AgoraErrorCodeWatermarkParam

124: Incorrect watermark file parameter.

Declared In AgoraEnumerates.h.

AgoraErrorCodeWatermarkPath

125: Incorrect watermark file path.

Declared In AgoraEnumerates.h.

AgoraErrorCodeWatermarkPng

126: Incorrect watermark file format.

Declared In AgoraEnumerates.h.

AgoraErrorCodeWatermarkInfo

127: Incorrect watermark file information.

Declared In AgoraEnumerates.h.

AgoraErrorCodeWatermarkAGRB

128: Incorrect watermark file data format.

Declared In AgoraEnumerates.h.

AgoraErrorCodeWatermarkRead

129: An error occurs in reading the watermark file.

Declared In AgoraEnumerates.h.

AgoraErrorCodeEncryptedStreamNotAllowedPublish

130: The encrypted stream is not allowed to publish.

Declared In AgoraEnumerates.h.

AgoraErrorCodeInvalidUserAccount

134: The user account is invalid.

Declared In AgoraEnumerates.h.

AgoraErrorCodePublishStreamCDNError

151: CDN related errors. Remove the original URL address and add a new one by calling the removePublishStreamUrl and addPublishStreamUrl methods.

Declared In AgoraEnumerates.h.

AgoraErrorCodePublishStreamNumReachLimit

152: The host publishes more than 10 URLs. Delete the unnecessary URLs before adding new ones.

Declared In AgoraEnumerates.h.

AgoraErrorCodePublishStreamNotAuthorized

153: The host manipulates other hosts' URLs. Check your app logic.

Declared In AgoraEnumerates.h.

AgoraErrorCodePublishStreamInternalServerError

154: An error occurs in Agora’s streaming server. Call the addPublishStreamUrl method to publish the stream again.

Declared In AgoraEnumerates.h.

AgoraErrorCodePublishStreamNotFound

155: The server fails to find the stream.

Declared In AgoraEnumerates.h.

AgoraErrorCodePublishStreamFormatNotSuppported

156: The format of the RTMP stream URL is not supported. Check whether the URL format is correct.

Declared In AgoraEnumerates.h.

AgoraErrorCodeLoadMediaEngine

1001: Fails to load the media engine.

Declared In AgoraEnumerates.h.

AgoraErrorCodeStartCall

1002: Fails to start the call after enabling the media engine.

Declared In AgoraEnumerates.h.

AgoraErrorCodeStartCamera

1003: Fails to start the camera.

DEPRECATED as of v2.4.1. Use AgoraLocalVideoStreamErrorCaptureFailure(4) in the error parameter of connectionChangedToState.

Declared In AgoraEnumerates.h.

AgoraErrorCodeStartVideoRender

1004: Fails to start the video rendering module.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmGeneralError

1005: A general error occurs in the Audio Device Module (the reason is not classified specifically). Check if the audio device is used by another app, or try rejoining the channel.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmJavaResource

1006: Audio Device Module: An error occurs in using the Java resources.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmSampleRate

1007: Audio Device Module: An error occurs in setting the sampling frequency.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmInitPlayout

1008: Audio Device Module: An error occurs in initializing the playback device.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmStartPlayout

1009: Audio Device Module: An error occurs in starting the playback device.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmStopPlayout

1010: Audio Device Module: An error occurs in stopping the playback device.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmInitRecording

1011: Audio Device Module: An error occurs in initializing the recording device.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmStartRecording

1012: Audio Device Module: An error occurs in starting the recording device.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmStopRecording

1013: Audio Device Module: An error occurs in stopping the recording device.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmRuntimePlayoutError

1015: Audio Device Module: A playback error occurs. Check your playback device, or try rejoining the channel.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmRuntimeRecordingError

1017: Audio Device Module: A recording error occurs.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmRecordAudioFailed

1018: Audio Device Module: Fails to record.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmPlayAbnormalFrequency

1020: Audio Device Module: Abnormal audio playback frequency.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmRecordAbnormalFrequency

1021: Audio Device Module: Abnormal audio recording frequency.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmInitLoopback

1022: Audio Device Module: An error occurs in initializing the loopback device.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmStartLoopback

1023: Audio Device Module: An error occurs in starting the loopback device.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmNoPermission

1027: Audio Device Module: An error occurs in no recording Permission.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmNoRecordingDevice

1359: No recording device exists.

Declared In AgoraEnumerates.h.

AgoraErrorCodeAdmNoPlayoutDevice

1360: No playback device exists.

Declared In AgoraEnumerates.h.

AgoraErrorCodeVdmCameraNotAuthorized

1501: Video Device Module: The camera is unauthorized.

Declared In AgoraEnumerates.h.

AgoraErrorCodeVcmUnknownError

1600: Video Device Module: An unknown error occurs.

Declared In AgoraEnumerates.h.

AgoraErrorCodeVcmEncoderInitError

1601: Video Device Module: An error occurs in initializing the video encoder.

Declared In AgoraEnumerates.h.

AgoraErrorCodeVcmEncoderEncodeError

1602: Video Device Module: An error occurs in video encoding.

Declared In AgoraEnumerates.h.

AgoraErrorCodeVcmEncoderSetError

1603: Video Device Module: An error occurs in setting the video encoder.

DEPRECATED

Declared In AgoraEnumerates.h.

Declared In

AgoraEnumerates.h

X
Is this page helpful?