-
Notifications
You must be signed in to change notification settings - Fork 36
Setup & Authentication
Your app may require the following permissions to work properly;
- Camera access
- Microphone access
- Photo library usage access
Before submitting your application to the store, please make sure the following permissions are already granted. To ask for permission, locate the info.plist
file and add:
NSCameraUsageDescription
NSMicrophoneUsageDescription
NSPhotoLibraryUsageDescription
AmityUIKit
requires an API key. You need a valid API key to begin using the UIKit. Please find your account API key in Amity Social Cloud Console.
After logging in Console:
- Click Settings to expand the menu.
- Select Security.
- In the Security page, you can find the API key in the Keys section.
If you have trouble finding this, you can post in our community forum so our support team can assist you.
import AmityUIKit
// in order to use AmityRegionalEndpoint enum, importing AmitySDK is required.
import AmitySDK
AmityUIKitManager.setup(apiKey: "api-key", region: .global)
📝 | AmityUIKitManager.setup should only be called once when app starts running. Calling the method repeatedly will create connection problems. |
---|
By default, AmityClient will connect to AmityRegion.SG
. You can specify endpoints manually via AmityEndpoint
struct. API endpoints for each data center are different so you need to adjust the endpoint accordingly.
let endpoint = AmityEndpoint(httpUrl: "http-endpoint",
rpcUrl: "rpc-endpoint",
mqttHost: "mqtt-host")
AmityUIKitManager.setup(apiKey: "api-key", endpoint: endpoint)
We currently support multi-data center capabilities for the following regions:
Region | Endpoint |
---|---|
Europe | AmityRegion.EU |
Singapore | AmityRegion.SG |
United States | AmityRegion.US |
To use any SDK feature, you must first register the current device with a userId
. A device registered with an userId
will be permanently tied to that userId
until you explicitly unregister the device, or until the device has been inactive for more than 90 days. A device registered with a specific userId
will receive all messages belonging to that user.
Additionally, an optional displayName
can be provided if you wish to have this user identified in push notifications.
AmityUIKitManager.registerDevice(withUserId: "USER_ID", displayName: "Ali Connors", authToken: "AUTH_TOKEN")
Registering your app for push notifications will require a device token as a parameter.
Amity's UIKit does not manage:
- User-facing requests for push notifications and authorizations
- The creation and refreshing of push notification tokens
It's up to your app to take those steps and pass the device token.
UIKitManager.registerDeviceForPushNotification("device-token") { isSuccess, error in
// Handle completion here
}
In the event that your user logs out, you should explicitly unregister the user from the SDK as well, to prevent the current device from receiving any unnecessary or restricted data.
AmityUIKitManager.unregisterDevice()