用户登出
<h1>用户登出</h1>
<p>直接使用BSSDKUI对应的类方法调用登出接口。
调用者需要传入对应的回调函数以处理API返回的结果。
当用户成功登出后,在界面上的悬浮球会消失。</p>
<h2>接口定义</h2>
<p>Swift</p>
<pre><code>extension BSSDKUI {
static func signOut(appID: String,
clientID: String,
clientKey: String,
success: @escaping SignOutSuccessHandler,
failure: @escaping FailureHandler)
}</code></pre>
<p>Objective-C</p>
<pre><code>@interface BSSDKUI
+ (void)signOutWithAppID:(NSString * _Nonnull)appID
clientID:(NSString * _Nonnull)clientID
clientKey:(NSString * _Nonnull)clientKey
success:(void (^ _Nonnull)(NSString * _Nonnull))success
failure:(void (^ _Nonnull)(BSSDKUIError * _Nonnull))failure;
@end</code></pre>
<h2>接口参数说明</h2>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>参数说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>appID</td>
<td>String</td>
<td>游戏App 的 ID</td>
</tr>
<tr>
<td>clientID</td>
<td>String</td>
<td>客户ID</td>
</tr>
<tr>
<td>clientKey</td>
<td>String</td>
<td>客户密钥</td>
</tr>
<tr>
<td>success</td>
<td>SignOutSuccessHandler</td>
<td>登录接口的成功回调</td>
</tr>
<tr>
<td>failure</td>
<td>FailureHandler</td>
<td>登录接口的失败回调</td>
</tr>
</tbody>
</table>
<h2>接口回调说明</h2>
<p>● 登录成功回调方法中参数说明:
<strong>Swift</strong></p>
<pre><code>public typealias SignOutSuccessHandler = (String) -&gt; Void</code></pre>
<table>
<thead>
<tr>
<th>回调参数说明:</th>
<th>参数名</th>
<th>类型</th>
<th>参数说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>memberID</td>
<td>string</td>
<td>登出成功后,用户的mem_id</td>
</tr>
</tbody>
</table>
<p>● 登录失败回调方法中参数说明:
<strong>Swift</strong></p>
<pre><code>@objc public final class BSSDKUIError: NSObject, Error {
@objc public let code: Int
@objc public let message: String
}</code></pre>
<p><strong>Objective-C</strong></p>
<pre><code>@interface BSSDKUIError : NSObject
@property (nonatomic, readonly) NSInteger code;
@property (nonatomic, readonly, copy) NSString * _Nonnull message;
@end</code></pre>
<table>
<thead>
<tr>
<th>该方法在产生业务逻辑错误时调用。</th>
<th>参数名</th>
<th>类型</th>
<th>参数说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>string</td>
<td>登录失败错误码</td>
</tr>
<tr>
<td>msg</td>
<td>string</td>
<td>登录失败的消息提示</td>
</tr>
</tbody>
</table>
<h2>调用完整代码</h2>
<p><strong>Swift</strong></p>
<pre><code>BSSDKUI.signOut(appID: &quot;your_app_id&quot;,
clientID: &quot;your_client_id&quot;,
clientKey: &quot;your_client_key&quot;,
success: { print(&quot;Sign out success:\($0)&quot;)},
failure: { print(&quot;Sign out Failed: \($0)&quot;)})</code></pre>
<p><strong>Objective-C</strong></p>
<pre><code>[BSSDKUI signOutWithAppID:@&quot;your_app_id&quot;
clientID:@&quot;your_client_id&quot;
clientKey:@&quot;your_client_key&quot;
success:^(NSString * _Nonnull memberID) {
NSLog(@&quot;Sign out success: %@&quot;, memberID);
}
failure:^(BSSDKUIError * _Nonnull error) {
NSLog(@&quot;Sign out Failed: %@&quot;, error);
}];</code></pre>