connection changed to connected connecting, because login login failed: AgoraRtmLoginErrorCode connection changed to connected disconnected, because loginFailure
func setupRTM() {
self.agoraRTM = AgoraRtmKit(
appId: "<#Agora App Id#>",
delegate: self
)
print("logging in as \(UIDevice.current.name)")
self.agoraRTM.login(
byToken: nil, user: UIDevice.current.name,
completion: self.rtmLoginCallback
)
}
func rtmLoginCallback(_ err: AgoraRtmLoginErrorCode) {
if err != .ok {
print("login failed: \(err)")
} else {
print("login success")
self.createAndJoin(channel: self.lobbyChannelName) { channel in
self.lobbyChannel = channel
}
}
}
You have to give an RTM token to log in.
self.agoraRTM.login(byToken: nil)
, the token should not be nil.Hope this link may help you:
https://docs.agora.io/en/signaling/get-started/get-started-sdk?platform=ios#1-set-your-signing-and-team