Unified feature set: Meeting, Messaging and CUCM calling.
Greater feature velocity and in parity with the Webex mobile app.
Easier for the developer community: SQLite is bundled for automatic data caching.
Greater quality as it is built on a more robust infrastructure.
Notes
Integrations created in the past will not work with v3 because they are not entitled to the scopes required by v3. You can either raise a support request to enable these scopes for your appId or you could create a new Integration that's meant to be used for v3. This does not affect Guest Issuer JWT token based sign in.
Starting a screenshare is not yet supported for CUCM calls.
Currently all resource ids that are exposed from the sdk are barebones GUIDs. You cannot directly use these ids to make calls to webexapis.com. You'll need to call Webex.base64Encode(:ResourceType:resource:completionHandler) to get a base64 encoded resource. However, you're free to interchange between base64 encoded resource ids and barebones GUID while providing them as input to the sdk APIs.
FedRAMP(
Federal Risk and Authorization Management Program) support from 3.1.0 onwards.
Install
Assuming you already have an Xcode project, e.g. MyWebexApp, for your iOS app, here are the steps to integrate the Webex iOS SDK into your Xcode project using CocoaPods:
Install CocoaPods:
gem install cocoapods
Setup CocoaPods:
pod setup
Create a new file, Podfile, with following content in your MyWebexApp project directory:
Install the Webex iOS SDK from your MyWebexApp project directory:
pod install
To your app’s Info.plist, please add an entry GroupIdentifier with the value as your app's GroupIdentifier. This is required so that we can get a path to store the local data warehouse.
If you'll be using WebexBroadcastExtensionKit, You also need to add an entry GroupIdentifier with the value as your app's GroupIdentifier to your Broadcast Extension target. This is required so that we that we can communicate with the main app for screen sharing.
Modify the Signing & Capabilities section in your xcode project as follows
A sample app that implements this SDK with source code can be found at https://github.com/webex/webex-ios-sdk-example . This is to showcase how to consume the APIs and not meant to be a production grade app.
Usage
To use the SDK, you will need Cisco Webex integration credentials. If you do not already have a Cisco Webex account, visit Webex for Developers to create your account and register your integration. Make sure you select Yes for Will this integration use a mobile SDK?. Your app will need to authenticate users via an OAuth grant flow for existing Cisco Webex users or a JSON Web Token for guest users without a Cisco Webex account.
See the iOS SDK area of the Webex for Developers site for more information about this SDK.
Example
Here are some examples of how to use the iOS SDK in your app.
Create the Webex instance using Webex ID authentication (OAuth-based):
let clientId ="$YOUR_CLIENT_ID"let clientSecret ="$YOUR_CLIENT_SECRET"let scope ="spark:all"// space separated list of scopes. spark:all is always requiredlet redirectUri ="https://webexdemoapp.com/redirect"let authenticator =OAuthAuthenticator(clientId: clientId, clientSecret: clientSecret, scope: scope, redirectUri: redirectUri, emailId: "[email protected]")
let webex =Webex(authenticator: authenticator)
webex.enableConsoleLogger=true
webex.logLevel= .verbose// Highly recommended to make this end-user configurable incase you need to get detailed logs.
webex.initialize { isLoggedIn inif isLoggedIn {
print("User is authorized")
} else {
authenticator.authorize(parentViewController: self) { result inif result == .success {
print("Login successful")
} else {
print("Login failed")
}
}
}
}
Create the Webex instance with Guest ID authentication (JWT-based):
let authenticator =JWTAuthenticator()
let webex =Webex(authenticator: authenticator)
webex.initialize { [weakself] isLoggedIn inguardletself=selfelse { return }
if isLoggedIn {
print("User is authorized")
} else {
authenticator.authorizedWith(jwt: myJwt) { result inswitch result {
case .failure(let error):print("JWT Login failed")
case .success(let authenticated):if authenticated {
print("JWT Login successful")
}
}
})
}
}
Use Webex service:
webex.spaces.create(title: "Hello World") { result inswitch result {
case .success(let space):// ...case .failure(let error):// ...
}
}
// ...
webex.memberships.create(spaceId: spaceId, personEmail: email) { result inswitch result {
case .success(let membership):// ...case .failure(let error):// ...
}
}
}
Make an outgoing call:
webex.phone.dial("[email protected]", option: MediaOption.audioVideo(local: ..., remote: ...)) { result inswitch result {
case .success(let call):
call.onConnected= {
// ...
}
call.onDisconnected= { reason in// ...
}
case .failure(let error):// failure
}
}
Make an outgoing CUCM call:
webex.phone.dial("+1180012345", option: MediaOption.audioVideo(local: ..., remote: ...)) { result inswitch result {
case .success(let call):
call.onConnected= {
// ...
}
call.onDisconnected= { reason in// ...
}
case .failure(let error):// failure
}
}
webex.phone.dial(spaceId, option: MediaOption.audioVideo(local: ..., remote: ...)) { result inswitch result {
case .success(let call):
call.onConnected= {
// ...
}
call.onDisconnected= { reason in// ...
}
call.onCallMembershipChanged= { changed inswitch changed {
case .joined(let membership)://case .left(let membership)://default://
}
}
case .failure(let error):// failure
}
}
Screen share (view only):
var selfVideoView =MediaRenderView()
var remoteVideoView =MediaRenderView()
var screenShareView =MediaRenderView()
webex.phone.dial("[email protected]", option: MediaOption.audioVideoScreenShare(video: (local: selfVideoView, remote: remoteVideoView), screenShare: screenShareView)) { ret inswitch ret {
case .success(let call):
call.onConnected= {
// ...
}
call.onDisconnected= { reason in// ...
}
call.onMediaChanged= { changed inswitch changed {
...case .remoteSendingScreenShare(let sending):
call.screenShareRenderView= sending ? view :nil
}
}
case .failure(let error):// failure
}
}
NOTE: Screen sharing will only work using v3 SDK with the latest WebexBroadcastExtensionKit.
Post a message:
let plain ="foo"let markdown ="**foo**"let html ="<strong>foo</strong>"
let text = Message.Text.html(html: html)
webex.messages.post(text, toPersonEmail: emailAddress, completionHandler: { response inswitch response.result {
case .success(let message):// ...case .failure(let error):// ...
}
}
let text = Message.Text.markdown(markdown: markdown)
webex.messages.post(text, toPersonEmail: emailAddress) { result inswitch result {
case .success(let message):// ...case .failure(let error):// ...
}
}
请发表评论