RemoteConfiguration
使用远程文件动态配置iOS、tvOS或watchOS应用程序。
使用方法
待办事项
不同更新类型的示例
可选更新:可选地显示警告
{
"customKey1": "customValue1",
"customKey2": "customValue2",
"customKey3": "customValue3",
"urlConfig": {
"baseUrl": "http://some.host.com/api/"
},
"appUpdate": {
"availableVersion": "1.2.3",
"url": "https://itunes.apple.com/app",
"type": "ignore"
}
}
推荐更新:始终显示警报,允许跳过
{
"customKey1": "customValue1",
"customKey2": "customValue2",
"customKey3": "customValue3",
"urlConfig": {
"baseUrl": "http://some.host.com/api/"
},
"appUpdate": {
"availableVersion": "1.2.3",
"url": "https://itunes.apple.com/theApp",
"type": "recommended",
"frequency": "always",
"localizedStrings": [
{
"languageCode": "de",
"regionCode": "DE",
"title": "Aktualisierung verfügbar",
"text": "Es steht eine empfohlene Aktualisierung zur Verfügung. Möchten sie diese jetzt installieren?",
"options": [
{
"title": "Nein"
},
{
"title": "Aktualisieren",
"isUpdateAction": true
}
]
}
]
}
}
推荐更新,只显示一次警报
{
"customKey1": "customValue1",
"customKey2": "customValue2",
"customKey3": "customValue3",
"urlConfig": {
"baseUrl": "http://some.host.com/api/"
},
"appUpdate": {
"availableVersion": "1.2.3",
"url": "https://itunes.apple.com/theApp",
"type": "recommended",
"frequency": "once",
"localizedStrings": [
{
"languageCode": "de",
"regionCode": "DE",
"title": "Aktualisierung verfügbar",
"text": "Es steht eine empfohlene Aktualisierung zur Verfügung. Möchten sie diese jetzt installieren?",
"options": [
{
"title": "Nein"
},
{
"title": "Aktualisieren",
"isUpdateAction": true
}
]
}
]
}
}
强制更新
{
"customKey1": "customValue1",
"customKey2": "customValue2",
"customKey3": "customValue3",
"urlConfig": {
"baseUrl": "http://some.host.com/api/"
},
"appUpdate": {
"availableVersion": "1.2.3",
"url": "https://itunes.apple.com/theApp",
"type": "mandatory",
"ignoredOSVersions": [
"12"
],
"localizedStrings": [
{
"languageCode": "de",
"regionCode": "DE",
"title": "Aktualisierung verfügbar",
"text": "Es steht eine benötigte Aktualisierung zur Verfügung.",
"options": [
{
"title": "Aktualisieren",
"isUpdateAction": true
}
]
}
]
}
}
版本 7.0.0 的更新
本版本中已删除对 CellularNetworking 的依赖。
将 RemoteConfiguration 绑定到 CellularNetworking 的适配器已移至 Example/Example/Controller/RemoteConfiguration+Adapter.swift
。此适配器必须复制到应用程序中以将 RemoteConfiguration 绑定到 CellularNetworking 或任何其他网络客户端(如 Alamofire 或 plain NSURLSession)。
版本 8.0.4 的更新
对于强制更新,现在可以忽略一个或多个 iOS 版本。包含在 "ignoredOSVersions" 数组中的 iOS 版本将不会对强制更新做出反应,直到从数组中删除该版本。如果您不再支持特定的 iOS 版本,但最后工作的版本应该仍然存在于 AppStore 中,并且不应通过强制更新被禁用,这可能会很有用。如果以后有 API 的重大更改,您仍然可以从列表中删除该版本,强制更新将与往常一样显示。