iOS SDK 对接文档

iOS SDK 对接文档


上传角色、区服信息

<h1>上传角色、区服信息</h1> <p>直接使用BSSDKUI对应的类方法调用登录接口。 接口调用场景 (<strong>以下场景必须调用,其它场景按需调用</strong>):</p> <pre><code>1. 创建角色 2. 角色进入服务器 3. 角色升级 4. 加入帮派、变更帮派、退出帮派 5. 使用改名卡</code></pre> <h2>接口定义</h2> <p><strong>Swift</strong></p> <pre><code>extension BSSDKUI { @objc public static func uploadCharacterInfo(appID: String, memberID: String, serverName: String, serverID: String, roleName: String, roleID: String, gangName: String, level: String, country: String, power: String, serverIDMerge: String, success: @escaping UploadCharacterInfoSuccessHandler, failure: @escaping FailureHandler) }</code></pre> <p><strong>Objective-C</strong></p> <pre><code>@interface BSSDKUI + (void)uploadCharacterInfoWithAppID:(NSString * _Nonnull)appID memberID:(NSString * _Nonnull)memberID serverName:(NSString * _Nonnull)serverName serverID:(NSString * _Nonnull)serverID roleName:(NSString * _Nonnull)roleName roleID:(NSString * _Nonnull)roleID gangName:(NSString * _Nonnull)gangName level:(NSString * _Nonnull)level country:(NSString * _Nonnull)country power:(NSString * _Nonnull)power serverIDMerge:(NSString * _Nonnull)serverIDMerge 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> <th>参数说明</th> </tr> </thead> <tbody> <tr> <td>appID</td> <td>String</td> <td>是</td> <td>必须游戏接入时分配的应用app_id</td> </tr> <tr> <td>memberID</td> <td>String</td> <td>是</td> <td>登陆时提供给CP的用户id</td> </tr> <tr> <td>serverName</td> <td>String</td> <td>是</td> <td>游戏区服名称</td> </tr> <tr> <td>serverID</td> <td>String</td> <td>是</td> <td>游戏区服id</td> </tr> <tr> <td>roleName</td> <td>String</td> <td>是</td> <td>角色名称</td> </tr> <tr> <td>roleID</td> <td>String</td> <td>是</td> <td>角色id</td> </tr> <tr> <td>gangName</td> <td>String</td> <td>是</td> <td>公会or帮派 默认传空(null,''),或传无</td> </tr> <tr> <td>level</td> <td>String</td> <td>是</td> <td>等级</td> </tr> <tr> <td>country</td> <td>String</td> <td>是</td> <td>国家</td> </tr> <tr> <td>power</td> <td>String</td> <td>是</td> <td>战力</td> </tr> <tr> <td>serverIDMerge</td> <td>String</td> <td>是</td> <td>合服后区服id</td> </tr> <tr> <td>success</td> <td>UploadCharacterInfoSuccessHandler</td> <td>是</td> <td>接口的成功回调</td> </tr> <tr> <td>failure</td> <td>FailureHandler</td> <td>是</td> <td>接口的失败回调</td> </tr> </tbody> </table> <h2>接口回调说明</h2> <p>● 支付成功回调方法中参数说明: <strong>Swift</strong></p> <pre><code>public typealias UploadCharacterInfoSuccessHandler = (String) -&amp;gt; Void</code></pre> <table> <thead> <tr> <th>回调参数说明:</th> <th>参数名</th> <th>类型</th> <th>参数说明</th> </tr> </thead> <tbody> <tr> <td>message</td> <td>string</td> <td>成功信息</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.uploadCharacterInfo(appID: &amp;quot;your_app_id&amp;quot;, memberID: &amp;quot;user_member_id&amp;quot;, serverName: &amp;quot;user_server_name&amp;quot; serverID: &amp;quot;user_server_id&amp;quot;, roleName: &amp;quot;user_role_name&amp;quot;, roleID: &amp;quot;user_role_id&amp;quot;, gangName: &amp;quot;user_gang_name&amp;quot;, level: &amp;quot;user_level&amp;quot;, country: &amp;quot;user_country&amp;quot;, power: &amp;quot;user_power&amp;quot;, serverIDMerge: &amp;quot;user_server_id_merge&amp;quot;, success: {print(&amp;quot;success: \($0)&amp;quot;)}, failure: {print(&amp;quot;failure: \($0)&amp;quot;)})</code></pre> <p><strong>Objective-C</strong></p> <pre><code>[BSSDKUI uploadCharacterInfoWithAppID:@&amp;quot;your_app_id&amp;quot; memberID:@&amp;quot;user_member_id&amp;quot; serverName:@&amp;quot;user_server_name&amp;quot; serverID:@&amp;quot;user_server_id&amp;quot; roleName:@&amp;quot;user_role_name&amp;quot; roleID:@&amp;quot;user_role_id&amp;quot; gangName:@&amp;quot;user_gang_name&amp;quot; level:@&amp;quot;user_level&amp;quot; country:@&amp;quot;user_country&amp;quot; power:@&amp;quot;user_power&amp;quot; serverIDMerge:@&amp;quot;user_server_id_merge&amp;quot; success:^(NSString * _Nonnull result) { NSLog(@&amp;quot;success: %@&amp;quot;, result);} failure:^(BSSDKUIError * _Nonnull error) { NSLog(@&amp;quot;failure: %@&amp;quot;, error);}];</code></pre>

页面列表

ITEM_HTML