测试测试 | ✗ |
语语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2016年10月 |
由 Richard Szabo,Dávid Horváth,Balazs Kovacs 维护。
SCForceUpdater 是一个简单的 pod,用于在 iOS 项目中实现强制更新功能。
要运行示例项目
pod install
,您可以通过以下方式启动示例服务器
cd TestServer/
切换到 TestServer 目录,bundle install
以安装依赖,ruby app.rb
运行测试服务器。这将在 https://:4567 上启动测试服务器。
SCForceUpdater 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "SCForceUpdater"
SCForceUpdater 提供类方法来配置它。
首先,您应该调用 SCForceUpdater 的初始化方法: initWithITunesAppId:baseURL:versionAPIEndpoint:
。建议在应用程序代理的 application:didFinishLaunchingWithOptions:
方法的开头执行此操作。
此外,您应该在 [SCForceUpdater sharedUpdater]
单例实例上调用 checkForUpdate
方法。我们建议在您的应用程序代理类的 applicationDidBecomeActive:
方法中执行此操作。
您还可以自定义应用程序的本地化:首先,您应该将 setAlwaysUseMainBundle:
设置为 YES,之后您应该能够重定义以下区域
键 | 含义 |
---|---|
sc.force-updater.soft.title | 软件更新的标题 |
sc.force-updater.soft.message | 软件更新的消息 |
sc.force-updater.soft.update | 软件更新按钮文本 |
sc.force-updater.soft.later | 软件更新稍后按钮文本 |
sc.force-updater.soft.no-thanks | 软件更新不谢按钮文本 |
sc.force-updater.hard.title | 强制更新的标题 |
sc.force-updater.hard.message | 强制更新的消息 |
sc.force-updater.hard.update | 强制更新按钮文本 |
消息(sc.force-updater.[soft|hard].message)是可以格式化的。它们可以处理两个参数:应用程序显示名和即将发布的版本。
类似于默认本地化:“好消息!{displayName} ({versionNumber})有更新版本,我们建议您安装它!”
如果您想设置应用程序的displayName,可以通过调用带有所需名称的setDisplayName:
类方法来实现。
我们在pod内部解析JSON对象。默认键为:last_version
对应版本键和update_type
对应更新类型键。
默认值可以通过两个设置方法来更改:setLastVersionResponseKey:
和setUpdateTypeResponseKey:
。
欢迎贡献! :)
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)SCForceUpdater遵守MIT许可证。有关更多信息,请参阅LICENSE文件。