Hi again,
I found a tutorial posted recently about how to use the iOS Zoom SDK with Swift.
AppDelegate.swift
import UIKit
import MobileRTC
import MobileCoreServices
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate,MobileRTCAuthDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: "ViewController") as! ViewController
let navigationController = UINavigationController(rootViewController: newViewController)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
let mainSDK = MobileRTCSDKInitContext()
mainSDK.domain = "zoom.us"
MobileRTC.shared().initialize(mainSDK)
let authService = MobileRTC.shared().getAuthService()
print(MobileRTC.shared().mobileRTCVersion)
authService?.delegate = self
authService?.clientKey = "Your Client Key"
authService?.clientSecret = "Your Client Secret Key"
authService?.sdkAuth()
return true
}
func onMobileRTCAuthReturn(_ returnValue: MobileRTCAuthError) {
print(returnValue)
if (returnValue != MobileRTCAuthError_Success)
{
let msg = "SDK authentication failed, error code: \(returnValue)"
print(msg)
}
}
}
and ViewController.swift
import UIKit
import MobileRTC
class ViewController: UIViewController {
let meetingNo = "Your Meeting Number"
let kSDKUserName = ""
override func viewDidLoad() {
super.viewDidLoad()
if(self.meetingNo == "") {
// If the meeting number is empty, return error.
print("Please enter a meeting number")
return
} else {
// If the meeting number is not empty.
let getservice = MobileRTC.shared().getMeetingService()
if let service = getservice {
service.delegate = self
let paramDict = [kMeetingParam_Username:kSDKUserName,kMeetingParam_MeetingNumber:meetingNo, kMeetingParam_MeetingPassword:"",kMeetingParam_WebinarToken:"Your Webinar Token"]
let response = service.joinMeeting(with: paramDict)
print("onJoinMeeting, response: \(response)")
}
}
}
}
extension ViewController: MobileRTCMeetingServiceDelegate{
func onMeetingStateChange(_ state: MobileRTCMeetingState) {
print("\(state)")
}
}
I tried to run that and got this “error”:
MobileRTCAuthError(rawValue: 0)
Do you have any clue about how to fix this?