SG iOS SDK allows you to connect to SG backend services easily when developing iOS App using Swift.
It's important for you to read through and understand the document before starting development.
Copy SGSDK.framework to project folder
In your Swift project, import SGSDK.
import SGSDK
SetListener(listener: @escaping (SGListenerResult) -> Void) -> VoidDescription
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
SGSDK.Instance.SetListener(listener: MsgListener) func MsgListener(result: SGListenerResult) { switch result.Code { case 201, 301, 1001, 801, 1501: // Login, Signup, Login by token break case 1101: // SG server validating receipt ok break case 1136: // appstore transaction ok break case 1141: // Restore break case 1201: // Get Order break case 8004: // Open ID break default: break } //print("code: \(result.Code), msg: \(result.Msg)") } |
Code
,Message
and Data
.
Based on different situation, Data
might be NULL or an object. Please refer to each function for more detail.
Init(GameKey: String, AppSecret: String) -> VoidDescription
Init
function once before any other functions.
Destroy() -> VoidDescription