iOS
The SDK initialization method is as follows. Please initialize the SDK in your app as soon as possible according to your own situation.
- Objective-C
- Swift
///Please use the following method for versions older than 2.0.2.1.
[AWPurchaseKit configureWithAppId:appid
uid:userId
completion:^(BOOL success, AWError * _Nonnull error) {
if (success) {
//init success ,do something
} else {
// init failed,check error
}
}];
///Use the following method for version 2.0.2.1 and above.
[AWPurchaseKit configureWithAppId:appId
secret:appSecret
uid:userId
completion:^(BOOL success, AWError * _Nonnull error) {
if (success) {
//init success ,do something
} else {
// init failed,check error
}
}];
///Please use the following method for versions older than 2.0.2.1.
AWPurchaseKit.configure(withAppId: appId,
uid: uid) { success, error in
if success == false {
// init failed,check error
} else {
//init success ,do something
}
}
///Use the following method for version 2.0.2.1 and above.
AWPurchaseKit.configure(withAppId: appId,
secret:appSecret,
uid: uid) { success, error in
if success == false {
// init failed,check error
} else {
//init success ,do something
}
}
Parameters:
- appId: Generated by AW server. For the generation steps, please refer to the document: New Application (External Use)
- secret: Added in V2.0.2.1 and is generated by AW server. For the generation steps, please refer to the document: New Application (External Use)
- uid: userId,Please do not use special characters, such as: '[` ~! @ # $% ^ & () + = | {} ':', \ \ [\ ] < > /? ~! @ # $%... & () - + | {} 【 】 '; : "",.,? ]', using special characters can cause unexpected problems. No userId can be passed an empty string.
- completion: Initialization result's block. Returns 'true' if initialization is successful; returns 'false' if not. This component can not be used in the case of configuration failure.