awslabs / amazon-kinesis-video-streams-webrtc-sdk-ios

iOS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
66 stars 29 forks source link

Error describing channel #49

Closed JoeyYang2010 closed 1 year ago

JoeyYang2010 commented 3 years ago

Hi there: I use this sdk to build ios app but I get "Error describing channel" many times. I don't know what's wrong,anyone can help,may thanks! Here is my code:

func retrieveChannelARN(channelName: String) {
print("retrive channel ARN",channelName)
if !channelName.isEmpty {
let describeInput = AWSKinesisVideoDescribeSignalingChannelInput()
describeInput?.channelName = channelName
let kvsClient = AWSKinesisVideo(forKey: awsKinesisVideoKey)
kvsClient.describeSignalingChannel(describeInput!).continueWith(block: { (task) -> Void in
if let error = task.error {
print("Error describing channel: (error)")
} else {
self.channelARN = task.result?.channelInfo?.channelARN
print("Channel ARN : ", task.result!.channelInfo!.channelARN ?? "Channel ARN empty.")
}
})//.waitUntilFinished()
// remove waitUntilFinished to set time out
} else {
return
}
}

Here is error: (if I met once,I will always get this error for several minutes.If I met once,I tried to get several different channel ARN,they were all fail) Error describing channel: Error Domain=com.amazonaws.AWSNetworkingErrorDomain Code=2 "URLSession is nil or invalidated" UserInfo={NSLocalizedDescription=URLSession is nil or invalidated}

hassanctech commented 2 years ago

Can you please confirm which commit you're using from the iOS SDK? Next there is a sample with instructions in the readme, did you try that to confirm the sample works?

JoeyYang2010 commented 2 years ago

Hi hassanctech: I use the master.The code can work but sometimes I got error describe channel.

sirknightj commented 1 year ago

Hi @JoeyYang2010,

I'm unable to replicate this. I tried clicking Connect as Master and Back repeatedly and did not encounter any issues.

Could you provide more details about how to replicate?

I did notice that you commented out ".waitUntilFinished()". Since we're performing an asynchronous fetch request, we need to wait for the fetch to complete before its value is available.

sirknightj commented 1 year ago

Closing due to no response.

As mentioned earlier, it is may be due to a race condition in the code snippet provided. Need the .waitUntilFinished().

Another possibility is that some of the values (e.g. identity pool id) are swapped around. Please make sure that the values inside of your awsconfiguration.json look similar to the sample configuration provided in this repository's readme, and that the Constants.swift file is also correct.

Also, please try the latest aws sdk for ios version, and the latest sample app. I was unable to replicate this even by clicking Connect as Master and Back repeatedly.

pod install --repo-update