应用更新
需要更新应用时,可调用 getDownloadUrl 获取应用商店的下载链接。应用侧可自行开发更新提示页引导用户前往该链接更新。
- Android
- iOS
fun getDownloadUrl(completionHandler: (GetDownloadUrlResult?, ComboSDKError?) -> Unit)
请求参数
| Properties | Type | Required | Description |
|---|---|---|---|
completionHandler | (GetDownloadUrlResult?, ComboSDKError?) -> Unit | true | 用于接收和处理结果的回调函数。 |
示例代码
Show Code
ComboSDK.getDownloadUrl { result, error ->
if (error != null) {
Log.e("ComboSDK", "Fetch Download URL Failed: ${error.error}")
return@getDownloadUrl
}
result?.let {
Log.d("ComboSDK", "URL: ${it.downloadUrl}")
}
}
static func getDownloadUrl(completionHandler: @escaping (GetDownloadUrlResult?, ComboSDKError?) -> Void)
请求参数
| Properties | Type | Required | Description |
|---|---|---|---|
completionHandler | (GetDownloadUrlResult?, ComboSDKError?) -> Void | true | 用于接收和处理结果的回调函数。 |
示例代码
Show Code
[ComboSDK getDownloadUrlWithCompletionHandler:^(GetDownloadUrlResult * _Nullable result, ComboSDKError * _Nullable error) {
if (error) {
NSLog(@"ComboSDK Fetch Download URL Failed: %@", error.error);
return;
}
NSLog(@"Fetch Download URL Success:\n URL: %@", result.downloadUrl);
}];
GetDownloadUrlResult
| Properties | Type | Description |
|---|---|---|
downloadUrl | String | 新版本应用的下载链接。 |
Error
| Error | Description |
|---|---|
SERVER_ERROR | 服务器错误。 |
NETWORK_ERROR | 网络错误。 |
UNKNOWN_ERROR | 未知错误。 |