GithubHelp home page GithubHelp logo

danielebogo / psupdateapp Goto Github PK

View Code? Open in Web Editor NEW
166.0 14.0 44.0 1.41 MB

PSUpdateApp is a simple method to notify users that a new version of your iOS app is available!

Home Page: https://github.com/danielebogo/PSUpdateApp

License: MIT License

Objective-C 96.55% Ruby 0.20% C 2.21% C++ 0.10% Shell 0.94%

psupdateapp's Introduction

PSUpdateApp

PSUpdateApp Version 2.0 is available!!!

The new version 2.0 is based on AFNetworking framework 2.0. AFNetworking 2.0 officially supports iOS 6+, Mac OS X 10.8+, and Xcode 5.

If you'd like to use PSUpdateApp in a project targeting a base SDK of iOS 5, or Mac OS X 10.7, use the latest tagged 1.x release.

A simple method to notify users that a new version of your iOS app is available.

About

PSUpdateApp notifies you if a new version of your iOS application is available in the AppStore or in any other place.
If a new version is available, PSUpdateApp presents an UIAlertView, that informs you of the newer version, and gives you the option to update the application.
The component is based on AFNetworking framework, using AFJSONRequestOperation method to read and parse the JSON response.

##Getting Started

Installation

The recommended approach for installating PSUpdateApp is via the CocoaPods package manager, as it provides flexible dependency management and dead simple installation. For best results, it is recommended that you install via CocoaPods >= 0.16.0 using Git >= 1.8.0 installed via Homebrew.

via CocoaPods

Install CocoaPods if not already available:

$ [sudo] gem install cocoapods
$ pod setup

Change to the directory of your Xcode project, and Create and Edit your Podfile and add PSUpdateApp:

$ cd /path/to/MyProject
$ touch Podfile
$ edit Podfile
platform :ios, '6.0' 
# Or platform :osx, '10.8'
pod 'PSUpdateApp', '~> 2.0.5'

Install into your project:

$ pod install

Open your project in Xcode from the .xcworkspace file (not the usual project file)

$ open MyProject.xcworkspace

via Download

Download PSUpdateApp or play with the example project. Open PSUpdateApp.xcworkspace (CocoaPods need).

Integration

PSUpdateApp has a simple integration:

  • Import PSUpdateApp.h into your AppDelegate or Pre-Compiler Header (.pch)
  • In your AppDelegate.m application:didFinishLaunchingWithOptions: create your PSUpdateApp object.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    self.window.rootViewController = [[MainViewController alloc] init];
    [self.window makeKeyAndVisible];
    
//--- DEFAULT MODE
//    Start in default mode with your appID.
    [[PSUpdateApp manager] startWithAppID:@"454638411"];

//--- CUSTOM LOCATION MODE
//    Start with your appID and with the store location. The default mode set the store location by the device location.
//    More information about the store code here: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
//    [[PSUpdateApp manager] startWithAppID:@"454638411" store:@"US"];
  
//--- CUSTOM URL MODE
//    You can start with a custom url, if you want to detect the version about a ad hoc distribution app.
//    [[PSUpdateApp manager] startWithRoute:FAKE_ROUTE];
    
//--- ALERT STRATEGIES
//    The strategies change the Alert buttons rappresentation
//    The Default Strategy has 2 buttons: "Skip this version" ans "Update"
//    You can set your strategy with:
//    DefaultStrategy   -> default mode
//    ForceStrategy     -> force the update. The alert has only the update button
//    RemindStrategy    -> Add the remind me button.
//    
//    You can set the strategy with:
//    [[PSUpdateApp manager] setStrategy:RemindStrategy];
//    
//    With RemindStrategy the alert will appear after 2 days (2 is the default value) from the remind action.
//    If you want you can set the days until promt with:
//    [[PSUpdateApp manager] setDaysUntilPrompt:10];

//--- ALERT TEXT
//    You can set a custom title and/or a custom message for the PSUpdateApp alert
//    [[PSUpdateApp manager] setAlertTitle:@"Custom Title"];
//    [[PSUpdateApp manager] setAlertDefaultMessage:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit."];

//    3 different properties for the message:
//    alertDefaultMessage   -> default mode
//    alertForceMessage     -> force the update. The alert has only the update button
//    alertRemindMessage    -> Add the remind me button.

    return YES;
}
  • In your AppDelegate.m applicationDidBecomeActive: start detect the available app version.
- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

//--- DETECT VERSION
//    Start to detect the version. In this case the block is nil, and the component use the default alert
    [[PSUpdateApp manager] detectAppVersion:nil];
    
//--- DETECT VERSION WITH BLOCK
//    You can use the completion block to implement you custom alert and actions
//    [[PSUpdateApp manager] detectAppVersion:^(NSError *error, BOOL success) {
//        NSLog(@"UPDATE");
//    }];
}

Custom Url

If you want to use PSUpdateApp in a distribution ad hoc, or in an enterprise app, you can start PSUpdateApp with startWithRoute: using a JSON with this structure:

{
  "results": [
    {
      "version": "3.0",
      "trackViewUrl": "http://paperstreetsoapdesign.com/development/updateapp/update.html",
      "type":"mandatory"
    }
  ]
}

Use setURLAdHoc: if you want to create a stringWithFormat: between your custom url and the appStoreLocation property of PSUpdateApp.

Notes

  • This project requires ARC and iOS target from 6.0
  • Use the PSUpdateApp properties to change the PSUpdateApp default value: for example the app name or store location
  • It's localized
  • It has a simple BDD test inside the example project
  • Into the custom JSON structure, it's a new field called "type", to set the PSUpdateStrategy from remote (DefaultStrategy or ForceStrategy).

Localizations

  • English
  • Italian
  • Spanish
  • Arabic
  • Korean
  • Chinese
  • Russian

Version

2.0.5

Created by:

Daniele Bogo

Credits

License

The MIT License (MIT) Copyright (c) 2014 Paper Street Soap Design

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

psupdateapp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

psupdateapp's Issues

Issues with ios9/xcode7

Hi,
once update the project where I'm using your pod to iOS9/xCode7, I'm getting this message:

PSUpdateApp.m:272:22: Using integer absolute value function 'abs' when argument is of floating point type

PSUdateApp.strings string value not displaying

I am using your project through cocoa pods. When the alert displays the button does not load the resource string correctly. It displays "alert.button.update" instead of the resource string value "Update". It appears you are loading the string from PSUdateApp.strings which appears to be added as a resource in the Pod library. Not sure why it won't load the string.

French localization

/*
Localizable.strings
PSUpdateApp

Created by iBo on 18/02/13.
Copyright (c) 2013 D-Still. All rights reserved.
*/

"alert.success.title" = "Mise à jour disponible";

"alert.success.default.text" = "Une nouvelle version de %@ est disponible. Voulez-vous passer à la version %@ maintenant?";
"alert.success.force.text" = "Une nouvelle version de %@ est disponible. Passez à la version %@ pour pouvoir continuer.";
"alert.success.remindme.text" = "Une nouvelle version de %@ est disponible. Voulez-vous passer à la version %@? Mettre à jour maintenant ou me le rappeler plus tard";

"alert.button.update" = "Mettre à jour";
"alert.button.skip" = "Passer cette version";
"alert.button.remindme" = "Pas maintenant. Me le rappeler plus tard";

Unable to update to AFNetworking 3.0

I'd really like to update to the latest version of AFNetworking, but my dependency on the PSUpdateApp is making this impossible. Is there any plan to update PSUpdateApp to use the latest version of AFNetworking?

Cocoapod returns me:

  • AFNetworking (~> 3.0) required by Podfile
  • AFNetworking (~> 2.0.0-RC2) required by PSUpdateApp (2.0.0)

Thanks a lot,
Andrea

Overwrites InfoPlist.strings

The PSUpdateApp pod includes InfoPlist.strings, which causes the app's InfoPlist.strings to be overwritten by the PSUpdateApp version, since the Copy Pods Resources build phase is (by default) executed after the Copy Bundle Resources build phase. The PSUpdateApp version of InfoPlist.strings should not be included in the pod.

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.