SCForceUpdater is a simple pod which implements force update functionality for your iOS projects.
To run the example project:
- clone this repository,
- run
pod install
from the Example directory, - start the sinatra project from the TestServer directory to try it.
You can start the example server by:
- change to the TestServer directory with
cd TestServer/
, - run
bundle install
to install dependencies, - run the test server with
ruby app.rb
.
This will bring up the test server listening on http://localhost:4567.
SCForceUpdater is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SCForceUpdater"
SCForceUpdater provides class methods to configure it.
First you should call SCForceUpdater's initialization method: initWithITunesAppId:baseURL:versionAPIEndpoint:
.
A good place to do this at the beginning of your application delegate's application:didFinishLaunchingWithOptions:
method.
Also you should call the checkForUpdate
method on the [SCForceUpdater sharedUpdater]
singleton instance. We recommand to do this in the applicationDidBecomeActive:
method of your application delegate class.
You can also customize the localization of the application: first you should set setAlwaysUseMainBundle:
to YES, after this you should be able to redefine the following locales:
Key | Meaning |
---|---|
sc.force-updater.soft.title | Title for soft update |
sc.force-updater.soft.message | Message for soft update |
sc.force-updater.soft.update | Update button text for soft update |
sc.force-updater.soft.later | Later button text for soft update |
sc.force-updater.soft.no-thanks | No thanks! button text for soft update |
sc.force-updater.hard.title | Title for hard update |
sc.force-updater.hard.message | Message for hard update |
sc.force-updater.hard.update | Update button text for hard update |
Messages (sc.force-updater.[soft|hard].message) are formattable. There is two parameter that they can handle: display name of the application and the upcoming version.
Like in the default localization: "Great news! There’s an updated version of {displayName} ({versionNumber}), we recommend you install it."
You can set the displayName of your application if you want. You can achive this by calling the setDisplayName:
class method with the required name.
We are parsing JSON objects inside the pod. The default keys are: last_version
for the version key and update_type
for the update type key.
The defaults can be changed through two setter methods: setLastVersionResponseKey:
and setUpdateTypeResponseKey:
.
Contributions are always welcome! :)
- Fork it ( http://github.com/team-supercharge/SCForceUpdater/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
SCForceUpdater is available under the MIT license. See the LICENSE file for more info.