User system is used to manage SG users, including signup, login and kids (family members ) management, etc. Most of the functions use WebView control as part of the process flow. To handle response of these functions, you need to register a callback listener to SGSDK.
Signup() -> VoidDescription
Login() -> VoidDescription
ForgotPassword() -> VoidDescription
ChangePassword() -> VoidDescription
ParentalLock() -> VoidDescription
MyKid() -> VoidDescription
VerifySession(gameKey: String, sessionId: String, openId: String, sign: String)Description
gameKey | Your developer identification. |
openId |
SG member ID. You can obtain it through GetOpenID() after user login. |
sessionId |
Current session ID. You can obtain it through GetSessionID() after user login. |
sign |
Signature generated from above three parameters. Please refer to signature algorithm. |
LoginByToken(token: String) -> VoidDescription
GetOpenID() -> String?Description
1 2 3 4 5 |
if let msg = SGSDK.Instance.GetOpenID() { //print("msg") } else { //print("Please login.") } |
GetSessionID() -> String?Description
1 2 3 4 5 |
if let msg = SGSDK.Instance.GetSessionID() { //print(msg) } else { //print("Please login.") } |
GetToken() -> String?Description
1 2 3 4 5 |
if let msg = SGSDK.Instance.GetToken() { //print(msg) } else { //print("Please login.") } |
GetKidIndex() -> Int?Description
GetKidFace() -> String?Description
IsLogin() -> BoolDescription
GetChannelID() -> StringDescription
ShowWidget(place: EWidgetLocation = .Left) -> VoidDescription
Enum : EWidgetLocation
Case | Description |
---|---|
TopLeft | Top left of the screen |
Top | Top of the screen |
TopRight | Top right of the screen |
Left | Left side of the screen |
Right | Right side of the screen |
BottomLeft | Bottom left of the screen |
Bottom | Bottom of the screen |
BottomRight | Bottom right of the screen |
HideWidget() -> VoidDescription
IsWidgetVisible() -> BoolDescription
Logout() -> VoidDescription
WXApiResp(errCode: Int, code: String) -> VoidDescription
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { var window: UIWindow? public func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { return WXApi.handleOpen(url, delegate: self) } public func application(_ application: UIApplication, handleOpen url: URL) -> Bool { return WXApi.handleOpen(url, delegate: self) } func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { return true } func onResp(_ resp: BaseResp!) { if let authresp = resp as? SendAuthResp { SGSDK.Instance.WXApiResp(errCode: Int(resp.errCode), code: authresp.code) } } func onReq(_ req: BaseReq!) { } } |