提交工单
咨询集成、功能及报价等问题
podfile
: pod init
Podfile
file to add the basic dependency:pod 'ZegoUIKitPrebuiltCall'
pod install
import ZegoUIKit
import ZegoUIKitPrebuiltCall
// YourViewController.swift
class ViewController: UIViewController {
//Other code...
}
appID
and appSign
of your project.userID
and userName
for connecting the Call Kit service. callID
that represents the call you want to make. userID
and callID
can only contain numbers, letters, and underlines (_). callID
can talk to each other. // YourViewController.swift
class ViewController: UIViewController {
// Other code...
var userID: String = <#UserID#>
var userName: String = <#UserName#>
var callID: String = <#CallID#>
@IBAction func makeNewCall(_ sender: Any) {
// You can also use groupVideo/groupVoice/oneOnOneVoice to make more types of calls.
let config: ZegoUIKitPrebuiltCallConfig = ZegoUIKitPrebuiltCallConfig(.oneOnOneVideoCall)
let callVC = ZegoUIKitPrebuiltCallVC.init(yourAppID,
appSign: yourAppSign,
userID: self.userID,
userName: self.userName,
callID: self.callID,
config: config)
callVC.modalPresentationStyle = .fullScreen
self.present(callVC, animated: true, completion: nil)
}
}
Then, you can make a new call by presenting the VC
.
Open the Info.plist
, add the following code inside the dict
part:
<key>NSCameraUsageDescription</key>
<string>We require camera access to connect to a call</string>
<key>NSMicrophoneUsageDescription</key>
<string>We require microphone access to connect to a call</string>
Now you have finished all the steps!
You can simply click the Run in XCode to run and test your App on your device.