iOSアプリをZohoに登録すると、クライアントIDとClientシークレットの組み合わせが生成されます。これらはiOSアプリとCreatorアプリケーションを連携させるために必須です。iOSアプリをZohoに登録するには、以下の手順に従ってください。
#インポートする <ZohoPortalAuthKit/ZohoPortalAuth.h>
インポートする ZCCoreFramework
クラス
: UIResponder, UIWindowSceneDelegate { var window: UIWindow ? func scene(
scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if let windowScene = scene as? UIWindowScene { let window = UIWindow(windowScene: windowScene) } let scope =
let clientID =
let clientSecret =
let portalId =
let urlScheme =
let accountsUrl =
// それぞれのDCの取引先URLを入力してください。例:EUユーザーは使用する必要があります
ZohoPortalAuth.initWithClientID(clientID, clientSecret: clientSecret, portalID: portalId, scope: scope, urlScheme: urlScheme, mainWindow: self.window!, accountsPortalURL: accountsUrl) // アプリが既にログインしている場合は認証するために使用します ZohoPortalAuth.getOauth2Token { (token, error) in if token ==
{ // 未ログインです self.showLoginScreen() } else { // アプリはすでにログイン済みです。 // Creator SDKの各メソッドを利用する前に、必ずiOSアプリ内で下記のコードを使用してください Creator.設定する(delegate: self) } } } func scene(
scene: UIScene, openURLContexts URLContexts: Set <UIOpenURLContext> ) { if let context = URLContexts.first { let
= ZohoPortalAuth.handleURL(context.url, sourceApplication: context.options.sourceApplication, annotation: context.options.annotation) } } } extension SceneDelegate: ZCCoreFrameworkDelegate { func oAuthToken(with completion: @escaping AccessTokenCompletion) { ZohoPortalAuth.getOauth2Token { (token, error) in completion(token, error) } } }
func showLoginScreen() { ZohoPortalAuth.presentZohoPortalSign( in: { (token, error) in if token !=
nil{ //ログインする 完了 } }) }
func logout() { ZohoPortalAuth.revokeAccessToken { (error) in if error ==
nil{ //ログアウトに成功しました } else { //エラーが発生しました } } }
「導入したばかりで基本操作や設定に不安がある」、「短期間で集中的に運用開始できる状態にしたい」、「運用を開始しているが再度学び直したい」 といった課題を抱えられているユーザーさまに向けた少人数制のオンライントレーニングです。
日々の営業活動を効率的に管理し、導入効果を高めるための方法を学びましょう。