I work on Enterprise iOS applications for a large energy company and do not have access to an MDM, but I recently had a requirement to provide an in-app way to notify users when an update is available and a way to update it immediately if they choose to. Another requirement was that it must be completely managed within the company's network, so systems like TestFlightApp were not an option. So I created a custom UpdateManager class that I reference in my AppDelegate as such:
- (void)applicationDidBecomeActive:(UIApplication *)application {
UpdateManager *mgr = [UpdateManager sharedManager];
[mgr setPListUrl:@"itms-services://?action=download-manifest&url=http://yourhost.com/path/to/yourapp.plist"];
[mgr setVersionUrl:@"http://yourhost.com/path/to/yourappupdate.json"];
[mgr checkForUpdates];
}
See the source here:
This code is also dependent on AFNetworking and UIAlertView-Blocks.
While it is not an option where I am using it now, DropBox is an excellent way to use this since it uses the proper content-type for .plist and .json files.
The updater will check each time the application is either started or brought out of the background and if it finds that the version specified in the target of your application is different than what is specified on the server, it will pop up a dialog box indicating that a new version is available. At that point, the user can select "OK" or "Cancel". If "OK" is selected, then it will launch safari and load the url specified in the pListUrl property. if "Cancel" is selected, then it will set a preference to prevent the user from being prompted, but in either case, a badge will be shown on the application's icon indicating that something needs attention. In my application, I have an UpdateViewController which looks similar to the one under General Preferences on your iOS device that gives the user the option to manually update via a button on the view if they opted not to update when prompted.
I'd be happy to have your feedback about how this could be improved!
© 2024 Created by Daniel Leuck. Powered by
You need to be a member of TechHui to add comments!
Join TechHui