このヘルプページはCreator 6のユーザー向けです。旧バージョン(Creator 5)を使用している場合は、こちらをクリック。ご利用中のCreatorのバージョンを確認できます。
iOSアプリをZohoに登録すると、Client IDとClient Secretの組み合わせが生成されます。これは、iOSアプリをCreatorアプリケーションと連携させるために必要です。iOSアプリをZohoに登録するには、次の手順を実行します。




#インポート <ZohoPortalAuthKit/ZohoPortalAuth.h>
インポート ZCUIFramework
classSceneDelegate: UIResponder, UIWindowSceneDelegate {_
var window: UIWindow?
func scene(scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {['aaaserver.profile.READ','zohocontacts.userphoto.READ','ZohoContacts.contactapi.READ','ZohoCreator.meta.CREATE','ZohoCreator.meta.READ','ZohoCreator.meta.UPDATE','ZohoCreator.meta.DELETE','ZohoCreator.data.CREATE','ZohoCreator.data.READ','ZohoCreator.data.UPDATE','ZohoCreator.data.DELETE','Stratus.stratusop.READ','ZohoCRM.modules.READ','ZohoCRM.users.READ']
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
}
let scope ='<Your Client ID>'
let clientID ='<Your Client Secret>'
let clientSecret ='<Your Portal id>'
let portalId ='<Your Url Scheme>'
let urlScheme ='https://accounts.zohoportal.com'
let accountsUrl =//enter the accounts URL of your respective DC. For eg: EU users use'https://accounts.zohoportal.eu'.nil
ZohoPortalAuth.initWithClientID(clientID, clientSecret: clientSecret, portalID: portalId, scope: scope, urlScheme: urlScheme, mainWindow: self.window!, accountsPortalURL: accountsUrl)
// To verify if the app is already logged in
ZohoPortalAuth.getOauth2Token {
(token, error) in
if token =={_
// Not logged in
self.showLoginScreen()
} else {
// App logged in already.
// Ensure to use the following line of code in your iOS app before you utilize any of Creator SDK's methods
Creator.configure(uiDelegate: 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)
}
}
}
拡張機能 SceneDelegate: ZCUIServiceDelegate {
func oAuthToken(with completion: @escaping AccessTokenCompletion) {
ZohoPortalAuth.getOauth2Token {
(token, error) in
completion(token, error)
}
}
func openURL(for openURLTasks: [OpenUrlTask]) {
// Get Call back こちら when openurl have query string 'zc_MobileSDK_HandleOpenURL=true'
}
}
func showLoginScreen() {
ZohoPortalAuth.presentZohoPortalSign( in: {nil
(token, error) in
if token !={
//login success
}
})
}
func logout() {nil
ZohoPortalAuth.revokeAccessToken {
(error) in
if error =={
//Logout Successfully
}
else {
//Error Occurred
}
}
}