当前位置:文档中心 > 一鍵免密

服务端接入接口

iosSDK接入文档

安卓SDK接入文档

DEMO及文档下载

7x24小时客服热线 >

售前:400-810-7255
售后:400-779-7255

执行概要

接口文档中设计的appId和secretKey需要通过亿美申请,由于涉及到加密通信,开发者必须严格对以上信息保密。

搭建环境

1、集成

将下载获取的 SDK ⽂件夹中的⽂件添加到⼯程中, 确保 Copy items if needed 已被勾选。

2、设置 Other linker Flags : -ObjC

3、在项⽬设置 target -> Build Phase -> Linked Binary with Libraries 添加如下依赖 库: libc++.1.tbd 、

libz.1.2.8.tbd 和 Network.framework 。

4、⽬前运营商个别接口为 http 请求,对于全局禁⽤ http 的项⽬,需要设置 http ⽩名单。以下为运营 商 http 接口域名和

ip 名单:wap.cmpassport.com、id6.me、mdn.open.wo.cn、 enrichgw.10010.com、opencloud.wostore.cn、

wostore.cn、zzx9.cn。配置 ATS,在 Info.plist ⽂件 中添加 App Transport Security Settings 项,并在其中添加

Exception Domains ⼦项,设置如下:

可以直接打开 Demo 的 Info.plist ⽂件,将对应 xml 代码拷⻉⾄您⾃⼰的⼯程的 Info.plist ⽂件中,如 下:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <false/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>wap.cmpassport.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
        <key>id6.me</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
        <key>mdn.open.wo.cn</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
        <key>opencloud.wostore.cn</key>
        <key>NSExceptionAllowsInsecureHTTPLoads</key>
        <true/>
    </dict>
    <key>enrichgw.10010.com</key>
    <dict>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
        <key>wostore.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
        <key>zzx9.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>
                                

基本功能

一键登录方法说明



1、初始化


保证在拉起授权页面前⾄少调⽤一次,建议在应⽤启动时或进⼊登录页面的前一个页面调⽤该方法。回调completion中的isSuccess :YES注册成功,NO注册失败,如果是NO,需要再调一次该初始化方 法

/**
初始化
 @param appID 产品ID
 @param secretKey 密钥
 @param completion 结果回调
 */
+ (void)initWithAppID:(NSString *)appID secretKey:(NSString *)secretKey
completion:(void(^)(BOOL isSuccess))completion;

2、打开授权页面


/**
进⾏⽤户认证授权, 获取网关 token 。
 @discussion 调⽤限制说明
为避免授权页面多次弹出, 在调⽤该方法后, 授权页面弹出, 再次调⽤该方法时,
该方法会直接跳出, 不执⾏授权逻辑。
 @discussion 需要⽤户在弹出的页面上同意服务意条款后, 才会进⾏免密认证。
 @param viewController present 认证页面控制器的 vc
 @param viewModel 自定义授权页面的视图模型
 @param completion 结果处理回调
 @seealso OLAuthViewModel
 */
+ (void)requestMobileWithViewController:(UIViewController *)viewController
 viewModel:(nullable OLAuthViewModel *)viewModel
 completion:(void(^)(NSDictionary * _Nullable
result))completion;

注意:

1、在成功进⼊授权页面时,不会⽴即收到 completion 回调,在授权页面点击一键登录、切换账号或者返回按钮时,才会收到 completion 回调;

2、若不能成功进⼊授权页面,则会⽴即收到 completion 回调

回调中result的字段如下:

获取成功:
 {
    "operatorType" : "CUCC",
    "token" :
    "1482D9142DC20060922AD806B0E4DDF3FC230E446051BAF108BD8E81F9ABF581",
    "errorCode" : "0",
    "msg" : "获取accessCode成功",
    "status" : 200,
 }
获取失败:
 {
    "status" : 500,
    "operatorType" : "CUCC",
    "msg" : "Can't access cellular.",
    "errorCode" : "-20202"
 }
参数 说明
status 状态码,200 表示成功,500 表示失败
token 换取⼿机号需要的 token
operatorType 运营商
errorCode 失败时的具体错误码
msg 失败时表示失败原因

3、关闭授权页面


/**
 @abstract 关闭当前的授权页面
 @param animated 是否需要动画
 @param completion 关闭页面后的回调
 @discussion
请不要使⽤其他方式关闭授权页面, 否则可能导致 OneLogin ⽆法再次调起
 */
+ (void)dismissAuthViewController:(BOOL)animated
                                    completion:(void (^__nullable)(void))completion;

4、重新开始预取号


/**
 * @abstract 重新预取号
 *
 * @discussion 在成功登录之后,为保证⽤户在退出登录之后,能快速拉起授权页面,请在⽤户退出登
录时,调⽤此方法
 */
+ (void)renewPreGetToken;

接口作用

在 SDK 初始化之后,调⽤ requestMobileWithViewController 获取 token 之前,SDK 内部会一直维 护预取号的结果,但是在调⽤ requestMobileWithViewController 获取 token 之后,就不再维护预 取号结果了,调⽤该接口,就会重新开始预取号,并维持预取号结果有效,以保证在⽤户退出登录之后 再次登录时能快速进⼊授权页面

调用时机

建议在⽤户退出登录时调⽤该接口


5、判断预取号结果是否有效


/**
 * @abstract 判断预取号结果是否有效
 *
 * @return YES: 预取号结果有效,可直接拉起授权页面 NO: 预取号结果⽆效,需加载进度条,等待
预取号完成之后拉起授权页面
 */
+ (BOOL)isPreGetTokenResultValidate;

接口作用

判断预取号结果是否有效

调用时机

调⽤ requestMobileWithViewController 时,判断是否需要加载进度条

授权页面 UI 修改


1、页面控件位置⼤小设置


亿美支持两种方式设置授权页面控件的位置和大小:

设置控件的 OLRect 属性,通过设置控件距离屏幕顶部和屏幕左边的偏移量来控制控件的位置,通过设置控件的宽⾼来控制控件的大小

在回调中拿到授权页面所有控件,通过 masnory 或其他方式进⾏⾃动布局


1.1、 设置控件的 OLRect 属性


/**
 * @abstract 1、若授权页面只支持竖屏,只设置竖屏方向偏移;
 2、若授权页面只支持横屏,只设置横屏方向偏移;
 3、若授权页面支持旋转⾃动切换横竖屏,则同时设置竖屏方向和横屏方向偏移
 4、弹窗模式,同以上1、2、3
 5、size默认都可以不⽤设置,会根据字体大小⾃适应
 6、x轴方向偏移量有两个值可以设置,portraitCenterXOffset为控件的x轴中点到弹
窗x轴中点的距离,portraitLeftXOffset为控件的左边缘到屏幕左边缘的距离,两者选其一即可
 */
typedef struct OLRect {
 /**
 竖屏时
 导航栏隐藏时,为控件顶部到状态栏的距离;导航栏显示时,为控件顶部到导航栏底部的距离
 弹窗时
 为控件顶部到弹窗顶部的距离
 */
 CGFloat portraitTopYOffset;

 /**
 竖屏时
 控件的x轴中点到屏幕x轴中点的距离,默认为0
 弹窗时
 控件的x轴中点到弹窗x轴中点的距离,默认为0
 */
 CGFloat portraitCenterXOffset;

 /**
 竖屏时
 控件的左边缘到屏幕左边缘的距离,默认为0
 弹窗时
 控件的左边缘到屏幕左边缘的距离,默认为0

 portraitLeftXOffset与portraitCenterXOffset设置一个即可,portraitLeftXOffset
优先级⼤于portraitCenterXOffset,
 设置此属性时,portraitCenterXOffset属性失效
 */
 CGFloat portraitLeftXOffset;

 /**
 横屏时
 导航栏隐藏时,为控件顶部到屏幕顶部的距离;导航栏显示时,为控件顶部到导航栏底部的距离
 弹窗时
 为控件顶部到弹窗顶部的距离
 */
 CGFloat landscapeTopYOffset;

 /**
 横屏时
 控件的x轴中点到屏幕x轴中点的距离,默认为0
 弹窗时
 控件的x轴中点到弹窗x轴中点的距离,默认为0
 */
 CGFloat landscapeCenterXOffset;

 /**
 横屏时
 控件的左边缘到屏幕左边缘的距离,默认为0
 弹窗时
 控件的左边缘到屏幕左边缘的距离,默认为0

 landscapeLeftXOffset与landscapeCenterXOffset设置一个即可,
landscapeLeftXOffset优先级⼤于landscapeCenterXOffset,
 设置此属性时,landscapeCenterXOffset属性失效
 */
 CGFloat landscapeLeftXOffset;

 /**
 控件大小,只有宽度、⾼度同时⼤于0,设置的size才会⽣效,否则为控件默认的size
 */
 CGSize size;
} OLRect;

/**
返回按钮位置及大小,返回按钮最⼤size为CGSizeMake(40, 40)。
 */
@property (nonatomic, assign) OLRect backButtonRect;

/**
 Logo 位置及大小。
 */
@property (nonatomic, assign) OLRect logoRect;

/**
号码预览 位置及大小
 */
@property (nonatomic, assign) OLRect phoneNumRect;

/**
授权⻚切换账号按钮 位置及大小。
 */
@property (nonatomic, assign) OLRect switchButtonRect;
/**
授权按钮 位置及大小。
 */
@property (nonatomic, assign) OLRect authButtonRect;

/**
 Slogan 位置及大小。
 */
@property (nonatomic, assign) OLRect sloganRect;

/**
授权页面上条款勾选框大小及位置。
 */
@property (nonatomic, assign) OLRect checkBoxRect;

/**
隐私条款 位置及大小,隐私条款,宽需⼤于50,⾼需⼤于20,才会⽣效。
 */
@property (nonatomic, assign) OLRect termsRect;

/**
弹窗 位置及大小。弹窗模式时,x轴偏移只支持portraitLeftXOffset和landscapeLeftXOffset。
 */
@property (nonatomic, assign) OLRect popupRect;

示例代码

OLRect backButtonRect = {0, 0, 0, 0, 0, 0, {0, 0}}; // 返回按钮偏移、大小设置,偏移
量和大小设置值需⼤于0,否则取默认值,默认可不设置
viewModel.backButtonRect = backButtonRect;
OLRect logoRect = {0, 0, 0, 20, 0, 0, {0, 0}}; // logo偏移、大小设置,偏移量和大小
设置值需⼤于0,否则取默认值,默认可不设置,logo大小默认为图⽚大小
viewModel.logoRect = logoRect;
OLRect phoneNumRect = {0, 0, 0, 0, 0, 0, {0, 0}}; // ⼿机号偏移设置
viewModel.phoneNumRect = phoneNumRect;
OLRect switchButtonRect = {0, 0, 0, 0, 0, 0, {0, 0}}; // 切换按钮偏移、大小设置,
偏移量和大小设置值需⼤于0,否则取默认值,默认可不设置
viewModel.switchButtonRect = switchButtonRect;
OLRect authButtonRect = {0, 0, 0, 0, 0, 0, {300, 40}}; // 授权按钮偏移、大小设
置,偏移量和大小设置值需⼤于0,否则取默认值,默认可不设置
viewModel.authButtonRect = authButtonRect;
OLRect sloganRect = {0, 0, 0, 0, 0, 0, {0, 0}}; // slogan偏移、大小设置,偏移量和
大小设置值需⼤于0,否则取默认值,默认可不设置
viewModel.sloganRect = sloganRect;
OLRect checkBoxRect = {0, 0, 0, 0, 0, 0, {12, 12}};
viewModel.checkBoxRect = checkBoxRect; // 复选框尺⼨,默认为12*12
OLRect termsRect = {0, 0, 0, 0, 0, 0, {0, 0}}; // 服务条款偏移、大小设置,偏移量和
大小设置值需⼤于0,否则取默认值,默认可不设置
viewModel.termsRect = termsRect;

1.2、控件进自动布局


/**
 * @abstract 授权页面视图控件⾃动布局回调,可在该回调中,对控件通过 masonry 或者其他方式进
⾏⾃动布局,若需要自定义视图,请直接在该回调中添加,实现该回调后,授权页面所有视图的约束都会被
删除,您需要重新设置所有视图的约束
 *
 * authView 为 authContentView 的⽗视图
 * authContentView 为 authBackgroundImageView、authNavigationView、
authLogoView、authPhoneView、authSwitchButton、authLoginButton、authSloganView、
authAgreementView、authClosePopupButton 的⽗视图
 * authNavigationView 为 authNavigationContainerView 的⽗视图
 * authNavigationContainerView 为 authBackButton 和 authNavigationTitleView 的⽗
视图
 * authAgreementView 为 authCheckbox 和 authProtocolView 的⽗视图
 *
 */
typedef void(^OLAuthVCAutoLayoutBlock)(UIView *authView, UIView
*authContentView, UIView *authBackgroundImageView, UIView *authNavigationView,
UIView *authNavigationContainerView, UIView *authBackButton, UIView
*authNavigationTitleView, UIView *authLogoView, UIView *authPhoneView, UIView
*authSwitchButton, UIView *authLoginButton, UIView *authSloganView, UIView
*authAgreementView, UIView *authCheckbox, UIView *authProtocolView, UIView
*authClosePopupButton);

/**
 * 授权页面视图控件⾃动布局回调
 */
@property (nullable, nonatomic, copy) OLAuthVCAutoLayoutBlock autolayoutBlock;

示例代码

viewModel.autolayoutBlock = ^(UIView *authView, UIView *authContentView,
UIView *authBackgroundImageView, UIView *authNavigationView, UIView
*authNavigationContainerView, UIView *authBackButton, UIView
*authNavigationTitleView, UIView *authLogoView, UIView *authPhoneView, UIView
*authSwitchButton, UIView *authLoginButton, UIView *authSloganView, UIView
*authAgreementView, UIView *authCheckbox, UIView *authProtocolView, UIView
*authClosePopupButton) {
 // content
 [authContentView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.edges.equalTo(authView);
 }];

 // background
 [authBackgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.edges.equalTo(authContentView);
 }];

 // navigation
 [authNavigationView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.left.top.right.equalTo(authContentView);
 make.height.mas_equalTo(64);
 }];

 [authNavigationContainerView mas_makeConstraints:^(MASConstraintMaker
*make) {
 make.edges.equalTo(authNavigationView);
 }];

 [authBackButton mas_makeConstraints:^(MASConstraintMaker *make) {
 make.left.equalTo(authNavigationContainerView).offset(20);
 make.centerY.equalTo(authNavigationContainerView).offset(10);
 make.size.mas_equalTo(CGSizeMake(20, 20));
 }];

 [authNavigationTitleView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.centerX.equalTo(authNavigationContainerView);
 make.centerY.equalTo(authNavigationContainerView).offset(10);
 make.size.mas_equalTo(CGSizeMake(100, 40));
 }];

 UIButton *rightBarButton = [UIButton buttonWithType:UIButtonTypeCustom];
 [rightBarButton setTitle:@"完成" forState:UIControlStateNormal];
 [rightBarButton addTarget:self action:@selector(doneAction:)
forControlEvents:UIControlEventTouchUpInside];
 [authNavigationContainerView addSubview:rightBarButton];
 [rightBarButton mas_makeConstraints:^(MASConstraintMaker *make) {
 make.right.equalTo(authNavigationContainerView).offset(-10);
 make.centerY.equalTo(authNavigationContainerView).offset(10);
 make.size.mas_equalTo(CGSizeMake(60, 40));
 }];

 // logo
 [authLogoView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.centerX.equalTo(authContentView);
 make.top.equalTo(authNavigationView.mas_bottom).offset(100);
 make.size.mas_equalTo(CGSizeMake(107, 22));
 }];

 // phone
 [authPhoneView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.centerX.equalTo(authContentView);
 make.top.equalTo(authLogoView.mas_bottom).offset(20);
 make.size.mas_equalTo(CGSizeMake(200, 40));
 }];

 // switchbutton
 [authSwitchButton mas_makeConstraints:^(MASConstraintMaker *make) {
 make.centerX.equalTo(authContentView);
 make.top.equalTo(authPhoneView.mas_bottom).offset(20);
 make.size.mas_equalTo(CGSizeMake(200, 20));
 }];

 // loginbutton
 [authLoginButton mas_makeConstraints:^(MASConstraintMaker *make) {
 make.centerX.equalTo(authContentView);
 make.top.equalTo(authSwitchButton.mas_bottom).offset(30);
 make.size.mas_equalTo(CGSizeMake(260, 40));
 }];

 // slogan
 [authSloganView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.centerX.equalTo(authContentView);
 make.top.equalTo(authLoginButton.mas_bottom).offset(20);
 make.size.mas_equalTo(CGSizeMake(260, 20));
 }];

 // agreementview
 [authAgreementView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.left.equalTo(authContentView).offset(20);
 make.right.equalTo(authContentView).offset(-20);
 make.top.equalTo(authSloganView.mas_bottom).offset(50);
 make.height.mas_equalTo(80);
 }];

 [authCheckbox mas_makeConstraints:^(MASConstraintMaker *make) {
 make.left.equalTo(authAgreementView).offset(10);
 make.top.equalTo(authAgreementView).offset(10);
 }];
 [authProtocolView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.left.equalTo(authCheckbox.mas_right).offset(5);
 make.right.equalTo(authAgreementView).offset(-10);
 make.height.equalTo(authAgreementView);
 }];

 // 自定义视图
 UIButton *customBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0,
200, 40)];
 [customBtn setTitle:@"我是自定义UI" forState:UIControlStateNormal];
 customBtn.backgroundColor = [UIColor lightGrayColor];
 customBtn.layer.cornerRadius = 2.0;
 [customBtn addTarget:self action:@selector(dismissAuthVC)
forControlEvents:UIControlEventTouchUpInside];
 [authContentView addSubview:customBtn];
 [customBtn mas_makeConstraints:^(MASConstraintMaker *make) {
 make.left.equalTo(authContentView).offset(20);
 make.right.equalTo(authContentView).offset(-20);
 make.height.mas_equalTo(40);
 make.top.equalTo(authAgreementView.mas_bottom).offset(30);
 }];
};

2、页面控件属性设置


#pragma mark - Status Bar/状态栏

/**
状态栏样式。 默认 `UIStatusBarStyleDefault`。
 */
@property (nonatomic, assign) UIStatusBarStyle statusBarStyle;

#pragma mark - Navigation/导航

/**
授权⻚导航的标题。默认为空字符串。
 */
@property (nullable, nonatomic, strong) NSAttributedString *naviTitle;

/**
授权⻚导航的背景颜⾊。默认⽩⾊。
 */
@property (nullable, nonatomic, strong) UIColor *naviBgColor;

/**
授权⻚导航左边的返回按钮的图⽚。默认⿊⾊系统样式返回图⽚。 */
@property (nullable, nonatomic, strong) UIImage *naviBackImage;

/**
授权⻚导航右边的自定义控件。
 */
@property (nullable, nonatomic, strong) UIView *naviRightControl;

/**
导航栏隐藏。默认不隐藏。
 */
@property (nonatomic, assign) BOOL naviHidden;

/**
返回按钮隐藏。默认不隐藏。
 */
@property (nonatomic, assign) BOOL backButtonHidden;

#pragma mark - Logo/图标

/**
授权页面上展示的图标。默认为 "OneLogin" 图标。
 */
@property (nullable, nonatomic, strong) UIImage *appLogo;

/**
 Logo 图⽚隐藏。默认不隐藏。
 */
@property (nonatomic, assign) BOOL logoHidden;

/**
 logo圆⻆,默认为0。
 */
@property (nonatomic, assign) CGFloat logoCornerRadius;

#pragma mark - Phone Number Preview/⼿机号预览

/**
号码预览⽂字的颜⾊。默认⿊⾊。
 */
@property (nullable, nonatomic, strong) UIColor *phoneNumColor;

/**
号码预览⽂字的字体。默认粗体,24pt。
 */
@property (nullable, nonatomic, strong) UIFont *phoneNumFont;

#pragma mark - Switch Button/切换按钮
/**
授权⻚切换账号按钮的⽂案。默认为“切换账号”。
 */
@property (nullable, nonatomic, copy) NSString *switchButtonText;

/**
授权⻚切换账号按钮的颜⾊。默认蓝⾊。
 */
@property (nullable, nonatomic, strong) UIColor *switchButtonColor;

/**
授权⻚切换账号按钮背景颜⾊。默认为 nil。
 */
@property (nullable, nonatomic, strong) UIColor *switchButtonBackgroundColor;

/**
授权⻚切换账号的字体。默认字体,15pt。
 */
@property (nullable, nonatomic, strong) UIFont *switchButtonFont;

/**
隐藏切换账号按钮。默认不隐藏。
 */
@property (nonatomic, assign) BOOL switchButtonHidden;

#pragma mark - Authorization Button/认证按钮

/**
授权⻚认证按钮的背景图⽚, @[正常状态的背景图⽚, 不可⽤状态的背景图⽚, ⾼亮状态的背景图⽚]。
默认正常状态为蓝⾊纯⾊, 不可⽤状态的背景图⽚时为灰⾊, ⾼亮状态为灰蓝⾊。
 */
@property (nullable, nonatomic, strong) NSArray<UIImage *> *authButtonImages;

/**
授权按钮⽂案。默认⽩⾊的"一键登录"。
 */
@property (nullable, nonatomic, strong) NSAttributedString *authButtonTitle;

/**
授权按钮圆⻆,默认为0。
 */
@property (nonatomic, assign) CGFloat authButtonCornerRadius;

#pragma mark - Slogan/口号标语

/**
 Slogan ⽂字颜⾊。默认灰⾊。
 */
@property (nonatomic, strong) UIColor *sloganTextColor;

/**
 Slogan字体。默认字体, 12pt。
 */
@property (nonatomic, strong) UIFont *sloganTextFont;

#pragma mark - CheckBox & Privacy Terms/隐私条款勾选框及隐私条款

/**
授权页面上条款勾选框初始状态。默认 YES。
 */
@property (nonatomic, assign) BOOL defaultCheckBoxState;

/**
授权页面上勾选框勾选的图标。默认为蓝⾊图标。推荐尺⼨为12x12。
 */
@property (nullable, nonatomic, strong) UIImage *checkedImage;

/**
授权页面上勾选框未勾选的图标。默认为⽩⾊图标。推荐尺⼨为12x12。
 */
@property (nullable, nonatomic, strong) UIImage *uncheckedImage;

/**
隐私条款⽂字属性。默认基础⽂字灰⾊, 条款蓝⾊⾼亮, 12pt。
 */
@property (nullable, nonatomic, strong) NSDictionary<NSAttributedStringKey,
id> *privacyTermsAttributes;

/**
额外的条款。默认为空。
 */
@property (nullable, nonatomic, strong) NSArray<OLPrivacyTermItem *>
*additionalPrivacyTerms;

/**
服务条款普通⽂字的颜⾊。默认灰⾊。
 */
@property (nullable, nonatomic, strong) UIColor *termTextColor;

/**
除隐私条款外的其他⽂案,数组大小必须为4,元素依次为:条款前的⽂案、条款一和条款⼆连接符、条款
⼆和条款三连接符,条款后的⽂案。
默认为@[@"登录即同意", @"和", @"、", @"并使⽤本机号码登录"]
 */
@property (nullable, nonatomic, copy) NSArray<NSString *>
*auxiliaryPrivacyWords;

/**
 * 点击授权页面隐私协议前勾选框的回调
 */
@property (nullable, nonatomic, copy) OLClickCheckboxBlock clickCheckboxBlock;

/**
* 服务条款⽂案对⻬方式,默认为NSTextAlignmentLeft
*/
@property (nonatomic, assign) NSTextAlignment termsAlignment;

#pragma mark - Background Image/授权页面背景图⽚

/**
授权⻚背景颜⾊。默认⽩⾊。
 */
@property (nullable, nonatomic, strong) UIColor *backgroundColor;

/**
授权页面背景图⽚
 */
@property (nullable, nonatomic, strong) UIImage *backgroundImage;

/**
横屏模式授权页面背景图⽚
 */
@property (nullable, nonatomic, strong) UIImage *landscapeBackgroundImage;

示例代码

// --------------状态栏设置 -------------------
viewModel.statusBarStyle = UIStatusBarStyleLightContent;

// -------------- 授权页面背景设置 -------------------
viewModel.backgroundColor = UIColor.lightGrayColor;

// -------------- 导航栏设置 -------------------
viewModel.naviTitle = [[NSAttributedString alloc] initWithString:@"一键登录"

attributes:@{NSForegroundColorAttributeName : UIColor.whiteColor,

NSFontAttributeName : [UIFont boldSystemFontOfSize:18]
 }]; // 导航
栏标题
viewModel.naviBgColor = UIColor.greenColor; // 导航栏背景⾊
viewModel.naviBackImage = [UIImage imageNamed:@"back"]; // 导航栏返回按钮
viewModel.backButtonHidden = NO; // 是否隐藏返回按钮,默认不隐藏

// -------------- logo设置 -------------------
viewModel.appLogo = [UIImage imageNamed:@"网关取号_logo"]; // 自定义logo图⽚
viewModel.logoHidden = NO; // 是否隐藏logo,默认不隐藏
viewModel.logoCornerRadius = 0; // logo圆⻆,默认为0

// -------------- ⼿机号设置 -------------------
viewModel.phoneNumColor = UIColor.redColor; // 颜⾊
viewModel.phoneNumFont = [UIFont boldSystemFontOfSize:25]; // 字体

// -------------- 切换账号设置 -------------------
viewModel.switchButtonColor = UIColor.brownColor; // 切换按钮颜⾊
viewModel.switchButtonFont = [UIFont systemFontOfSize:15]; // 切换按钮字体
viewModel.switchButtonText = @"自定义切换按钮⽂案"; // 切换按钮⽂案
viewModel.switchButtonHidden = NO; // 是否隐藏切换按钮,默认不隐藏

// -------------- 授权登录按钮设置 -------------------
viewModel.authButtonImages = @[
 [UIImage imageNamed:@"bg_logo_launch"],
 [UIImage imageNamed:@"bg_logo_launch"],
 [UIImage imageNamed:@"bg_logo_launch"]
 ]; // 授权按钮背景图⽚
viewModel.authButtonTitle = [[NSAttributedString alloc] initWithString:@"授权登
录"

attributes:@{NSForegroundColorAttributeName : UIColor.whiteColor,

NSFontAttributeName : [UIFont boldSystemFontOfSize:18]
 }];
// 登录按钮⽂案

viewModel.authButtonRect = authButtonRect;
viewModel.authButtonCornerRadius = 0; // 授权按钮圆⻆,默认为0
viewModel.clickAuthButtonBlock = ^(void) { // 点击授权页面登录按钮回调
 NSLog(@"clickAuthButtonBlock");
};

// -------------- slogan设置 -------------------
viewModel.sloganTextColor = UIColor.cyanColor; // slogan颜⾊
viewModel.sloganTextFont = [UIFont systemFontOfSize:14]; // slogan字体

// -------------- 服务条款设置 -------------------
viewModel.defaultCheckBoxState = YES; // 是否默认选择同意服务条款,默认同意

3、横竖屏设置


/**
 * 授权页面支持的横竖屏方向
 */
@property (nonatomic, assign) UIInterfaceOrientationMask
supportedInterfaceOrientations;

通过设置 supportedInterfaceOrientations 属性,即可控制授权页面的横竖屏,授权页面可以支持横竖 屏⾃由组合,若设置授权页面同时支持竖屏和横屏,授权页面会跟随设备旋转⾃动进⾏横竖屏切换

示例代码

// -------------- 授权页面支持的横竖屏设置 -------------------
viewModel.supportedInterfaceOrientations =
UIInterfaceOrientationMaskAllButUpsideDown;

4、弹窗模式设置


#pragma mark - Popup

/**
 * 是否为弹窗模式
 */
@property (nonatomic, assign) BOOL isPopup;

/**
弹窗 位置及大小。弹窗模式时,x轴偏移只支持portraitLeftXOffset和landscapeLeftXOffset。
 */
@property (nonatomic, assign) OLRect popupRect;

/**
弹窗圆⻆,默认为6。
 */
@property (nonatomic, assign) CGFloat popupCornerRadius;

/**
当只需要设置弹窗的部分圆⻆时,通过popupCornerRadius设置圆⻆大小,通过popupRectCorners
设置需要设置圆⻆的位置。
 popupRectCorners数组元素不超过四个,超过四个时,只取前四个。⽐如,要设置左上和右上为圆⻆,
则传值:@[@(UIRectCornerTopLeft), @(UIRectCornerTopRight)]
 */
@property (nonatomic, strong) NSArray<NSNumber *> *popupRectCorners;

/**
 * 弹窗动画类型,当popupAnimationStyle为OLAuthPopupAnimationStyleStyleCustom时,动
画为⽤户自定义,⽤户需要传一个CATransition对象来设置动画
 */
@property (nonatomic, assign) OLAuthPopupAnimationStyle popupAnimationStyle;

/**
 * 弹窗自定义动画
 */
@property (nonatomic, strong) CAAnimation *popupTransitionAnimation;

/**
弹窗关闭按钮图⽚,弹窗关闭按钮的尺⼨跟图⽚尺⼨保持一致。
弹窗关闭按钮位于弹窗右上⻆,⽬前只支持设置其距顶部偏移和距右边偏移。
 */
@property (nullable, nonatomic, strong) UIImage *closePopupImage;

/**
弹窗关闭按钮距弹窗顶部偏移。
 */
@property (nonatomic, strong) NSNumber *closePopupTopOffset;

/**
弹窗关闭按钮距弹窗右边偏移。
 */
@property (nonatomic, strong) NSNumber *closePopupRightOffset;

/**
是否需要通过点击弹窗的背景区域以关闭授权页面。
*/
@property (nonatomic, assign) BOOL canClosePopupFromTapGesture;

/**
* 点击授权页面弹窗背景的回调
*/
@property (nonatomic, copy) OLTapAuthBackgroundBlock tapAuthBackgroundBlock;

通过设置 isPopup 属性为 YES,即可以弹窗模式弹出授权页面,可自定义弹窗的大小、弹窗弹出动画形 式及弹窗圆⻆,弹窗中各控件大小、位置、属性的设置同上

示例代码

OLAuthViewModel *viewModel = [OLAuthViewModel new];
viewModel.isPopup = YES;
viewModel.switchButtonHidden = YES;

// --------------点击弹窗背景收起弹窗 -------------------
viewModel.canClosePopupFromTapGesture = YES;

// -------------- 弹窗设置 -------------------

// 自定义弹窗动画
viewModel.popupAnimationStyle = OLAuthPopupAnimationStyleCoverVertical; // 弹窗
动画⻛格,支持CoverVertical、StyleFlipHorizontal、CrossDissolve和自定义模式,默认为
CoverVertical
CATransition *animation = [CATransition animation];
animation.duration = 1;
animation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.type = @"rippleEffect";
animation.subtype = kCATransitionFromLeft;
viewModel.popupTransitionAnimation = animation; // 只有在popupAnimationStyle为
OLAuthPopupAnimationStyleCustom时⽣效

// 弹窗位置、大小设置,弹窗默认大小为300*340,居于屏幕中间,假如要弹窗居于底部,可做如下设置
OLRect popupRect = {[self ol_screenHeight] - 340, 0, 0, 0, 0, 0, {[self
ol_screenWidth], 340}}; // 弹窗偏移、大小设置
viewModel.popupRect = popupRect;
viewModel.popupCornerRadius = 8; // 弹窗圆⻆,默认为6
viewModel.popupRectCorners = @[@(UIRectCornerTopLeft),
@(UIRectCornerTopRight)]; // 设置部分圆⻆
viewModel.closePopupImage = [UIImage imageNamed:@"back"]; // 关闭按钮
viewModel.closePopupTopOffset = @(3); // 关闭按钮距弹窗顶部偏移
viewModel.closePopupRightOffset = @(-8); // 关闭按钮距弹窗右边偏移

viewModel.tapAuthBackgroundBlock = ^{
 NSLog(@"tapAuthBackgroundBlock");
};

__weak typeof(self) wself = self;
// 在SDK内部预取号未成功时,建议加载进度条
if (![EMOneLoginSDK isPreGetTokenResultValidate]) {

}
// --------------授权页面生命周期回调 -------------------
viewModel.viewLifeCycleBlock = ^(NSString *viewLifeCycle, BOOL animated) {
 NSLog(@"viewLifeCycle: %@, animated: %@", viewLifeCycle, animated ? @"YES"
: @"NO");
 if ([viewLifeCycle isEqualToString:@"viewDidDisappear:"]) {

 } else if ([viewLifeCycle isEqualToString:@"viewDidLoad"]) {
 // 授权页面出现时,关掉进度条
 }
};

5、授权页面中添加自定义控件


/**
 * @abstract 授权登录页面自定义视图,customAreaView为授权页面的view,如,可将三方登录添
加到授权登录页面
 */
typedef void(^OLCustomUIHandler)(UIView *customAreaView);

/**
自定义区域视图的处理block
 @discussion
提供的视图容器使⽤NSLayoutConstraint与相关的视图进⾏布局约束。
如果导航栏没有隐藏, 顶部与导航栏底部对⻬, 左边与屏幕左边对⻬, 右边与屏幕右边对⻬, 底部与屏
幕底部对⻬。
如果导航栏隐藏, 顶部与状态栏底部对⻬, 左边与屏幕左边对⻬, 右边与屏幕右边对⻬, 底部与屏幕底
部对⻬。
 */
@property (nullable, nonatomic, copy) OLCustomUIHandler customUIHandler;

示例代码

// -------------- 自定义UI设置,如,可以在授权页面添加三方登录⼊口 -------------------
UIButton *customBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 200,
40)];
[customBtn setTitle:@"我是自定义UI" forState:UIControlStateNormal];
customBtn.backgroundColor = [UIColor redColor];
customBtn.layer.cornerRadius = 2.0;
[customBtn addTarget:self action:@selector(dismissAuthVC)
forControlEvents:UIControlEventTouchUpInside];
__block CGFloat customAreaWidth = 0;
__block CGFloat customAreaHeight = 0;
viewModel.customUIHandler = ^(UIView * _Nonnull customAreaView) {
 [customAreaView addSubview:customBtn];
 customBtn.center = CGPointMake(customAreaView.bounds.size.width/2,
customAreaView.bounds.size.height/2 + 150);
 customAreaWidth = customAreaView.bounds.size.width >
customAreaView.bounds.size.height ? customAreaView.bounds.size.height :
customAreaView.bounds.size.width;
 customAreaHeight = customAreaView.bounds.size.width <
customAreaView.bounds.size.height ? customAreaView.bounds.size.height :
customAreaView.bounds.size.width;
};

6、自定义授权页面 loading


/**
 * 授权⻚自定义Loading,会在点击登录按钮之后触发
 * containerView为loading的全屏蒙版view
 * 请⾃⾏在containerView添加自定义loading
 * 设置block后,默认loading将⽆效
 */
typedef void(^OLLoadingViewBlock)(UIView *containerView);

/**
 * 停⽌授权⻚自定义Loading,会在调⽤[OneLogin stopLoading]时触发
 * containerView为loading的全屏蒙版view
 */
typedef void(^OLStopLoadingViewBlock)(UIView *containerView);

/**
 * 授权页面,自定义加载进度条,点击登录按钮之后的回调
 */
@property (nonatomic, copy, nullable) OLLoadingViewBlock loadingViewBlock;

/**
 * 授权页面,停⽌自定义加载进度条,调⽤[OneLogin stopLoading]之后的回调
 */
@property (nonatomic, copy, nullable) OLStopLoadingViewBlock
stopLoadingViewBlock; 

示例代码

// -------------- 授权页面⾃动旋转时的回调,在该回调中调整自定义视图的frame,若授权页面不
支持⾃动旋转,或者没有添加自定义视图,可不⽤实现该block -------------------
viewModel.authVCTransitionBlock = ^(CGSize size,
id<UIViewControllerTransitionCoordinator> _Nonnull coordinator, UIView *
_Nonnull customAreaView) {
    if (size.width > size.height) { // 横屏
        customBtn.center = CGPointMake(customAreaHeight/2, customAreaWidth/2 -15);
    } else { // 竖屏
        customBtn.center = CGPointMake(customAreaWidth/2, customAreaHeight/2 + 150);
    }
};

// -------------- 授权页面点击登录按钮之后的loading设置 -------------------
viewModel.loadingViewBlock = ^(UIView * _Nonnull containerView) {
    if ([OneLogin isProtocolCheckboxChecked]) {
        UIActivityIndicatorView *indicatorView = [[UIActivityIndicatorView
alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
        [containerView addSubview:indicatorView];
        indicatorView.center = CGPointMake(containerView.bounds.size.width/2,
containerView.bounds.size.height/2);
        [indicatorView startAnimating];
 }
};

7、设置服务条款


#pragma mark - CheckBox & Privacy Terms/隐私条款勾选框及隐私条款

/**
授权页面上条款勾选框初始状态。默认 YES。
 */
@property (nonatomic, assign) BOOL defaultCheckBoxState;

/**
授权页面上勾选框勾选的图标。默认为蓝⾊图标。推荐尺⼨为12x12。
 */
@property (nullable, nonatomic, strong) UIImage *checkedImage;

/**
授权页面上勾选框未勾选的图标。默认为⽩⾊图标。推荐尺⼨为12x12。
 */
@property (nullable, nonatomic, strong) UIImage *uncheckedImage;

/**
授权页面上条款勾选框大小。
 */
@property (nonatomic, assign) CGSize checkBoxSize
__attribute__((deprecated("use checkBoxRect instead.")));

/**
授权页面上条款勾选框大小及位置。
 */
@property (nonatomic, assign) OLRect checkBoxRect;

/**
隐私条款⽂字属性。默认基础⽂字灰⾊, 条款蓝⾊⾼亮, 12pt。
 */
@property (nullable, nonatomic, strong) NSDictionary<NSAttributedStringKey,
id> *privacyTermsAttributes;

/**
额外的条款。默认为空。
 */
@property (nullable, nonatomic, strong) NSArray<OLPrivacyTermItem *>
*additionalPrivacyTerms;

/**
服务条款普通⽂字的颜⾊。默认灰⾊。
 */
@property (nullable, nonatomic, strong) UIColor *termTextColor;

/**
隐私条款 位置及大小,隐私条款,宽需⼤于50,⾼需⼤于20,才会⽣效。
 */
@property (nonatomic, assign) OLRect termsRect;

/**
除隐私条款外的其他⽂案,数组大小必须为4,元素依次为:条款前的⽂案、条款一和条款⼆连接符、条款
⼆和条款三连接符,条款后的⽂案。
默认为@[@"登录即同意", @"和", @"、", @"并使⽤本机号码登录"]
 */
@property (nullable, nonatomic, copy) NSArray<NSString *>
*auxiliaryPrivacyWords;

/**
 * 点击授权页面隐私协议前勾选框的回调
 */
@property (nullable, nonatomic, copy) OLClickCheckboxBlock clickCheckboxBlock;

/**
* 服务条款⽂案对⻬方式,默认为NSTextAlignmentLeft
*/
@property (nonatomic, assign) NSTextAlignment termsAlignment;

/**
 * 点击授权页面运营商隐私协议的回调
 */
@property (nullable, nonatomic, copy) OLViewPrivacyTermItemBlock
carrierTermItemBlock;

/**
 * 是否在运营商协议名称上加书名号《》
 */
@property (nonatomic, assign) BOOL hasQuotationMarkOnCarrierProtocol;

/**
 * 未勾选勾选框时,是否禁⽌一键登录按钮的点击
 */
@property (nonatomic, assign) BOOL disableAuthButtonWhenUnchecked;

示例代码

// 隐私条款⽂字属性
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]
init];
paragraphStyle.lineSpacing = 1.33;
paragraphStyle.alignment = NSTextAlignmentLeft;
paragraphStyle.paragraphSpacing = 0.0;
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
paragraphStyle.firstLineHeadIndent = 0.0;
viewModel.privacyTermsAttributes = @{
 NSForegroundColorAttributeName :
UIColor.orangeColor,
 NSParagraphStyleAttributeName :
paragraphStyle,
 NSFontAttributeName : [UIFont
systemFontOfSize:12]
 };
// 额外自定义服务条款,注意index属性,默认的index为0,SDK会根据index对多条服务条款升序排
列,假如想设置服务条款顺序为 自定义服务条款1 默认服务条款 自定义服务条款2,则,只需将自定义服
务条款1的index设为-1,自定义服务条款2的index设为1即可
OLPrivacyTermItem *item1 = [[OLPrivacyTermItem alloc] initWithTitle:@"自定义服务
条款1"
 linkURL:[NSURL
URLWithString:@"https://docs.geetest.com/onelogin/overview/start"]
 index:0

block:^(OLPrivacyTermItem * _Nonnull termItem, UIViewController *controller) {

NSLog(@"termItem.termLink: %@, controller: %@", termItem.termLink,
controller);
 // 自定义操
作,可进⼊自定义服务条款页面

 }];
OLPrivacyTermItem *item2 = [[OLPrivacyTermItem alloc] initWithTitle:@"自定义服务
条款2"
 linkURL:[NSURL
URLWithString:@"https://docs.geetest.com/"]
 index:0];
// 加载本地的html
NSURL *URL = [[NSBundle mainBundle] URLForResource:@"index.html"
withExtension:nil];
NSURLRequest *URLRequest = [NSURLRequest requestWithURL:URL];
OLPrivacyTermItem *item3 = [[OLPrivacyTermItem alloc] initWithTitle:@"自定义服务
条款3"
 urlRequest:URLRequest
 index:0
 block:nil];
viewModel.additionalPrivacyTerms = @[item1, item2, item3];
OLRect termsRect = {0, 0, 0, 0, 0, 0, {0, 0}}; // 服务条款偏移、大小设置,偏移量和
大小设置值需⼤于0,否则取默认值,默认可不设置
viewModel.termsRect = termsRect;
viewModel.auxiliaryPrivacyWords = @[@"条款前⽂案", @"&", @"&", @"条款后的⽂案"];
// 条款之外的⽂案,默认可不设置

viewModel.clickCheckboxBlock = ^(BOOL isChecked) { // 点击隐私条款前勾选框回
调
NSLog(@"clickCheckboxBlock isChecked: %@", isChecked ? @"YES" : @"NO");
};

viewModel.termsAlignment = NSTextAlignmentCenter;

8、设置授权页面弹出模式


授权页面弹出模式与 iOS UIViewController 的弹出模式保持一致,支持两种方式弹出授权页面,默认以 模态方式弹出授权页面

/**
 * @abstract 进⼊授权页面的方式,默认为 modal 方式,即 present 到授权页面,从授权页面进
⼊服务条款页面的方式与此保持一致
 *
 * @discussion push 模式时,不支持弹窗模式,进⼊授权页面时,会隐藏导航栏,退出授权页面时,
会显示导航栏,如果您进⼊授权页面的当前页面导航栏为隐藏状态,在授权页面消失时,请注意将导航栏隐
藏
 */
typedef NS_ENUM(NSInteger, OLPullAuthVCStyle) {
 OLPullAuthVCStyleModal,
 OLPullAuthVCStylePush
};
#pragma mark - OLPullAuthVCStyle
/**
 * @abstract 进⼊授权页面的方式,默认为 modal 方式,即 present 到授权页面,从授权页面进
⼊服务条款页面的方式与此保持一致
 */
@property (nonatomic, assign) OLPullAuthVCStyle pullAuthVCStyle;

示例代码

viewModel.pullAuthVCStyle = OLPullAuthVCStylePush; // 默认为 modal

9、设置状态栏


授权页面状态栏已默认适配⿊夜模式,若您使⽤ SDK 默认的授权页面,可以⽆需设置状态栏,若您需 要改变授权页面的背景,请您根据实际情况设置状态栏

/**
状态栏样式。 默认 `UIStatusBarStyleDefault`。
 */
@property (nonatomic, assign) UIStatusBarStyle statusBarStyle;

示例代码

olAuthViewModel.statusBarStyle = UIStatusBarStyleDefault;

其他接口说明


1、设置⽇志开关


设置⽇志开关,建议开发调试时打开⽇志,上线时关闭⽇志

/**
 * @abstract 设置是否允许打印⽇志
 *
 * @param enabled YES,允许打印⽇志 NO,禁⽌打印⽇志
 */
+ (void)setLogEnabled:(BOOL)enabled;

2、获取当前网络信息和运营商信息


获取当前网络信息和运营商信息,该接口可判断当前是否开启了 Wifi 和 蜂窝移动网络,并能准确判断 当前蜂窝移动网络是 4G、3G 还是 2G,还能判断当前对应的运营商

/**
获取当前 OneLogin 可⽤的网络信息
 @discussion
当使⽤的是⾮移动、联通、电信三⼤运营商, 则返回nil。
 OneLogin 仅在⼤陆支持移动、联通、电信三⼤运营商。
 @seealso
 OLNetworkInfo 中有属性的详细描述
 */
+ (nullable OLNetworkInfo *)currentNetworkInfo;

3、设置超时时长


设置请求超时时长

/**
设置请求超时时长。默认时长8s。
 @param timeout 超时时长
 */
+ (void)setRequestTimeout:(NSTimeInterval)timeout;

4、服务条款复选框是否勾选


判断服务条款左边复选框是否勾选

/**
 * @abstract 服务条款左边复选框是否勾选
 */
+ (BOOL)isProtocolCheckboxChecked;

5、获取SDK版本号


获取 SDK 版本号

/**
获取SDK版本号
 @return SDK当前的版本号
 */
+ (NSString *)getVersion;

6、获取当前授权页面


获取当前授权页面对应的 Controller

/**
 * @abstract 获取当前授权页面对应的ViewController
 *
 * @return 当前授权页面对应的ViewController
 */
+ (UIViewController * _Nullable)currentAuthViewController;

7、回调接口


7.1、加载授权页面进度条回调


/**
 * 授权⻚自定义Loading,会在点击登录按钮之后触发
 * containerView为loading的全屏蒙版view
 * 请⾃⾏在containerView添加自定义loading
 * 设置block后,默认loading将⽆效
 */
typedef void(^OLLoadingViewBlock)(UIView *containerView);

7.2、停⽌授权页面进度条回调


/**
 * 停⽌授权⻚自定义Loading,会在调⽤ stopLoading 时触发
 * containerView为loading的全屏蒙版view
 */
typedef void(^OLStopLoadingViewBlock)(UIView *containerView);

7.3、授权页面视图生命周期回调


/**
 * 授权页面视图生命周期回调
 * @param viewLifeCycle 值为viewDidLoad、viewWillAppear、viewWillDisappear、
viewDidAppear、viewDidDisappear
 * @param animated 是否有动画
 */
typedef void(^OLAuthViewLifeCycleBlock)(NSString *viewLifeCycle, BOOL
animated);

7.4、监听授权按钮点击的回调


/**
 * 点击授权页面授权按钮的回调,⽤于监听授权页面登录按钮的点击
 */
typedef void(^OLClickAuthButtonBlock)(void);

7.5、点击授权页面勾选框的回调


/**
 * 点击授权页面隐私协议前勾选框的回调
 */
typedef void(^OLClickCheckboxBlock)(BOOL isChecked);

7.6、点击授权页面弹窗背景的回调


/**
 * 点击授权页面弹窗背景的回调
 */
typedef void(^OLTapAuthBackgroundBlock)(void);

7.7、授权页面旋转时的回调


/**
 * @abstract 授权页面旋转时的回调,可在该回调中修改自定义视图的frame,以适应新的布局
 */
typedef void(^OLAuthVCTransitionBlock)(CGSize size,
id<IViewControllerTransitionCoordinator> coordinator, UIView
*customAreaView);

7.8、接管授权按钮点击事件的回调


/**
 * 是否自定义授权页面登录按钮点击事件,⽤于完全接管授权页面点击事件,当返回 YES 时,可以在
block 中添加自定义操作
 */
typedef BOOL(^OLCustomAuthActionBlock)(void);

7.9、点击切换账号按钮的回调


/**
 * 点击授权页面切换账号按钮的回调
 */
typedef void(^OLClickSwitchButtonBlock)(void);

7.10、点击运营商隐私协议的回调



typedef void(^OLViewPrivacyTermItemBlock)(OLPrivacyTermItem *termItem,
UIViewController *controller);

/**
 * 点击授权页面运营商隐私协议的回调
 */
@property (nullable, nonatomic, copy) OLViewPrivacyTermItemBlock
carrierTermItemBlock;
TOP