Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Error Handling and Troubleshooting

Max Cobb edited this page Apr 8, 2022 · 3 revisions

The purpose of this document is to list all of the errors, warnings that Agora UIKit may produce, and some common troubleshooting for this package.

Agora UIKit Error Types

Error Type Description
AgoraVideoViewer.PermissionError This error can occur when the user has not given permissions to devices such as the camera or microphone. Also check your Info.plist to make sure the relevant permissions have been added to your application's Info.plist
AgoraVideoViewer.TokenError This error occurs whenever there is an issue fetching a token from a provided tokenURL. A common reason for this could be that the token URL provided has a "/" at the end, the token server is down, or a different token server than expected is being used.
AgoraRtmController.TokenError Similar to AgoraVideoViewer.TokenError, this will also occur when there is an issue fetching a token from your provided token server URL.

Error Logging

All other errors will be printed to the console in the format: [AgoraVideoViewer LOG_LEVEL]: Example Message")

The LOG_LEVEL value will be one of "ERROR", "WARNING", "DEBUG" or "INFO". By default, only "WARNING" and "ERROR" values will appear; this can be changed by setting the static property AgoraVideoViewer.printLevel to an alternative enum value.

Here are some errors that you may see in Xcode's console:

Error Message Description
[AgoraVideoViewer ERROR]: Could not enable video This can occur for a few reasons, including a bad appID being supplied. Check the Agora Console that your appId, and token (if needed) are correct.
[AgoraVideoViewer ERROR]: Could not present popup If you don't provide a delegate for AgoraVideoViewer, or your delegate is not a UIViewController, the SDK cannot show popups such as ones used to request others mute/unmute devices. You will need to supply your own presentAlert method in this case.
Check out AgoraVideoViewerDelegate.presentAlert to see more about this method.
[AgoraVideoViewer ERROR]: Could not fetch token from server: ERROR_VAL This means the fetching of a token failed. The ERROR_VAL will be one of the AgoraVideoViewer.TokenError values mentioned above.

Common Issues

Importing the Library

Since version 1.8.0 Agora UIKit underwent a few changes, and is now made up of more than one library. Part of this means that you can now just use parts of Agora UIKit, including a wrapper for the RTM library from Agora; this wrapper is called AgoraRtcControl. this reduces your app size but also means there's an extra click when installing the library.

Import Name

When importing the library from version 1.8.0 and above, use the new module name AgoraUIKit as so:

import AgoraUIKit

When using a version earlier than 1.8.0, use import AgoraUIKit_iOS.

App Target Is Missing Libraries

Make sure both of these checkmarks are selected before proceeding to the next step when adding the import via Swift Package Manager.

agora-uikit-dependencies

Alternatively, if you have already included the package and are still seeing an issue with missing imports: Head to your App's target, Build Phases, and add the two libraries (AgoraUIKit and AgoraRtmControl) to "Link Binary With Libraries".

agora-uikit-link-libraries

App Crashing

If your app is crashing, the most common issue when making a video calling application is that the privacy settings have not yet been added to your Info.plist. You may see a log in Xcode similar to this:

2022-04-08 13:50:15.936744+0200 Agora_UIKit-Example[11574:880873] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.

For information on how to fix this, follow this guide from Apple.