Zoom iOS SDK可加入会议但无法发起会议问题求助
Hey there! It’s super frustrating when joining meetings works but starting them doesn’t—let’s break down the likely issues and fix this step by step.
First, Let’s Address the Obvious: Your JWT Token is Expired
Looking at the token you provided, its expiration timestamp (exp) is 1592574525, which translates to June 19, 2020. That token is long expired, so it’s definitely invalid for starting meetings right now. You’ll need to generate a fresh, valid JWT token from your Zoom Developer Console first.
Beyond expiration, double-check your JWT payload:
- Ensure
audis set to"zoom.us"(required for Zoom API/SDK JWT tokens) - Confirm the
issvalue matches your Zoom SDK Key (found in your app’s settings in the Zoom Console) - Make sure the associated user (
gurpal@relinns.com) has meeting host permissions (free Zoom users can’t start meetings via the SDK—you need a Pro/Enterprise license for the user)
Fix Parameter Mismatches & Missing Required Fields
Your current code has a few potential parameter issues:
- User ID Case Sensitivity: Your code uses
gurpal@relinns.comas the userID, but the commented-outgetUserTokencall usesGurpal@relinns.com. Zoom user IDs (emails) are case-sensitive—make sure the userID matches exactly what’s in your Zoom Account Portal. - Missing Meeting Type: When starting an instant meeting, you need to explicitly specify the meeting type. Add this to your
paramDict:paramDict[kMeetingParam_MeetingType] = MobileRTCMeetingType.instant.rawValue - Confirm Authentication State: Your
isAPIAuthenticatedcheck relies on a custom variable—make sure it’s only set totrueafter the SDK confirms successful authentication via theMobileRTCAuthDelegatecallback:
Don’t try starting a meeting until this callback confirms auth success.func onMobileRTCAuthReturn(_ returnValue: MobileRTCAuthError) { if returnValue == .success { isAPIAuthenticated = true } else { print("Auth failed: \(returnValue)") } }
Check the Actual Error Code (Not Just the Generic Message)
The "Unable to connect" message is a generic fallback—pay attention to the returnValue from startMeeting(with:). Print the full error enum to get precise info:
print("Zoom: Start meeting failed, error: \(returnValue), code: \(returnValue.rawValue)")
Common error codes to look for:
MobileRTCMeetError_InvalidUserToken: Token is invalid/expired/missing permissionsMobileRTCMeetError_UserNotAllowed: The user doesn’t have host permissions to start meetingsMobileRTCMeetError_InvalidParam: One or more parameters (like userID, meeting type) are incorrect
Revised Start Meeting Code Example
Here’s a cleaned-up version of your function with fixes for the above issues:
func startInstantMeeting(name: String = ZoomAPI.defaultName) { guard let meetingService = MobileRTC.shared().getMeetingService() else { print("Zoom: Meeting service unavailable") return } // Verify SDK is authenticated first let authService = MobileRTC.shared().getAuthService() guard authService?.getAuthentication() == .authenticated else { print("Zoom: SDK not authenticated—complete auth before starting meetings") return } var paramDict: [String : Any] = [ kMeetingParam_Username: name, kMeetingParam_UserID: ZoomAPI.userID, // Match Zoom portal email exactly kMeetingParam_UserToken: ZoomAPI.userToken, // Use fresh, valid JWT kMeetingParam_MeetingType: MobileRTCMeetingType.instant.rawValue // Critical for instant meetings ] let result = meetingService.startMeeting(with: paramDict) guard result == .success else { print("Zoom: Start meeting failed - Error: \(result), Code: \(result.rawValue)") return } print("Zoom: Meeting started successfully!") }
Final Checks
- Ensure your Zoom SDK version is up to date (old versions might have bugs with meeting initiation)
- Confirm the device has a working internet connection (you said joining works, so this is likely fine, but double-check no VPN/firewall is blocking outgoing Zoom SDK traffic specifically for hosting)
内容的提问来源于stack exchange,提问作者relinnse

