Giter Site home page Giter Site logo

batjo / misenterpriseupdater Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prehypenyc/misenterpriseupdater

0.0 1.0 0.0 95 KB

Simple component to check if an iOS Enterprise build needs an update.

License: MIT License

Objective-C 64.80% Swift 26.98% Ruby 8.22%

misenterpriseupdater's Introduction

MISEnterpriseUpdater

Simple component to check if an iOS Enterprise build needs an update.

MISDropdownViewController uses ARC and supports iOS 7.0+

Installing

MISEnterpriseUpdater can be installed by CocoaPods. Simply add this line to your Podfile:

pod 'MISEnterpriseUpdater'

And run pod install.

Or just add the files from the MISEnterpriseUpdater-ObjC or MISEnterpriseUpdater-Swift folder to your project.

Usage

static NSString * const MISEnterpriseUpdaterPlistFileURLString = @"URL to plist";

NSURL *url = [NSURL URLWithString:MISEnterpriseUpdaterPlistFileURLString];

[MISEnterpriseUpdater checkVersionWithURL:url success:^(BOOL requiresUpdate, NSString *versionString, NSURL *updateURL) {
    NSLog(@"Requires Update: %d", requiresUpdate);
    NSLog(@"Version String: %@", versionString);
    NSLog(@"Update URL: %@", updateURL);

    // No update required
    if (!requiresUpdate) { return; }

    // Update required
    NSString *messageString = [NSString stringWithFormat:NSLocalizedString(@"Version %@ is available.", nil), versionString];
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Update Available", nil) message:messageString preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *installAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Install", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
        [[UIApplication sharedApplication] openURL:updateURL];
       }];
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {}];

    [alert addAction:installAction];
    [alert addAction:cancelAction];
    [self presentViewController:alert animated:YES completion:nil];
} failure:^(NSError *error) {
    NSLog(@"MISEnterpriseUpdater Error: %@", error);
}];

Creator

Michael Schneider @maicki

License

MISEnterpriseUpdater is available under the MIT license. See the LICENSE file for more info.

misenterpriseupdater's People

Contributors

chrisricca avatar maicki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.