iOS - Prompt User to Update to Latest App Version - iphone

Is there any method or plugin available that will alert the user to upgrade an app if the version they are using is not the latest? I suppose I could ping a web service to check what the current version is and compare with the user's version and go from there. As an aside, is there a way to check the current version of the app (some property I don't know about) or do you simply have to hardcode the version as some float variable or something?
Thanks

There's a nice little open source library available called Harpy that will accomplish this for you! It provides the ability to check for updates on startup, daily, or weekly, and it uses itunes to do the checking, so config is really minimal.

you will need to build the update check functionality yourself. however you can get the version info from the app.
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
Bear in mind tho that just because you have an app up. and it has been released into the store. that does not mean the app is immediately available to all users via the app store.

There is update version of harpy called siren that will help you. Below is the link,
https://github.com/ArtSabintsev/Siren

You'll have to build such a solution yourself. There's no update-checking functionality provided by the iOS SDK.
Most apps just check a website or similar, as you've already considered.

You can grab the version from the info.plist with
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
self.applicationVersion = [infoDict objectForKey:#"CFBundleVersion"];
self.applicationBuild = [infoDict objectForKey:#"CFBundleShortVersionString"];
And, yes just hit a web service. Or even easier you could just put a file up on S3 and update that with your version number.

Related

How to show ios app version number WITHOUT objective-c code [duplicate]

This question already has answers here:
Closed 10 years ago.
This is not a duplicate. The referenced duplicate question specifically asks
"Is there a way in objective-C to find out what the version is of my app?"
whereas the current question asks how it can be found without writing any code.
Possible Duplicate:
How can my iphone app detect its own version number?
I am writing an ios app and would like my trial users to be able to tell me what version they are using.
I know that you can programmatically display the installed version of your app to a user as in these two posts:
How can I check the bundle version of our application programmatically? and How to display the current project version of my App to the user?
But do I have to do it programmatically? How can I show ios app version number WITHOUT objective-c code? On android the version is automatically available under Manage Applications.
I think you want to show your current version in the Settings bundle and the use your Info.plist to know the version as explained in the links in your question.
Here is a little tutorial:
http://www.slideshare.net/livatlantis/iphone-dev-application-settings-and-defaults
Hope to be useful!
The following code will give you the version you have defined in your plist. You can use that to populate a UILabel.
NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*)kCFBundleVersionKey];
You could use that information to populate a Settings Bundle so that it would show up in the main settings.app on the phone.
There is no built in support for showing the user the bundle version. You should use the links you have found to fetch and display the value yourself.
If this is a matter of finding out already distributed app's version numbers, there are ways of reading the plist, but this doesn't use built-in support. You might want to have a look at iFile (if jailbroken) or iExplorer if not jailbroken. These allow you view the ios device filesystem and read files directly. (iExplorer is limited to what files you can read, but you can read Info plists)

check and update an application through code when a new version is available in appstore

Within my application, I want to check if there is any updated version of my application is in the app store. If there is any, then have to inform the user through an alert message and if he/she opt for upgrade I want to update the new version.I want to do all this through my application. Is this possible?
You can store the most current application version string on your server. When the app is activated, request this information from the server and compare it to the version string that is contained in your applications Info.plist.
You can get the version in Info.plist like this
[[NSBundle mainBundle] objectForInfoDictionaryKey:#"CFBundleShortVersionString"]
If the string differs, you can show an alert that a newer version is available in the app store. You can also link directly to the app store from the alert.
You could do something like this: let's say you just started making an app. You hardcode its version (1.0) inside the app's configuration file or something similar.
Then, you can use an universal xml configuration file, which is read by the app everytime it starts and connects to the internet. Inside that xml, make a field named "lastest_version", where you set that value.
When the app starts you can check the xml. If your hardcoded value is 1.0 and inside the xml you get 1.1, this means you need an update.
This is how we do it and, just like Philippe said, we also use an plist to store the original version value.

How to maintain app settings when user updates to new version

When we update an application, the settings which are selected by the user in the old version should be kept after updating to the newer version.
Let me explain this with an simple example:
Version 1.0 of my app has a switch that is ON by default but the user can set OFF. In the App Store I am going to publish next version— 1.1—with some modification but it also has the same switch. When the user updates it from the device the switch value should stay OFF.
How can I achieve this kindly reply me with your valuable comments...
Thanx in advance...
You can simply use NSUserDefaults
App 1.1 can easily read what App 1.0 wrote.
When you update your app to a newer version, then the UserDefault have no change (If dont remove app).
Then what we have to do is detect whether your app is updated to a newer version. What I did in my app is maintain a variable in UserDefault like "CurrentAppVersion", then when app is launched I check the currentVersion which getting from app Bundle, if they are difference and up, then I migrate my settings to a new version and update "CurrentAppVersion" to a new version also.
Reference:
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
NSString *currentAppVersion = [userDefault objectForKey:#"CurrentAppVersion"];
NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:#"CFBundleVersion"];
NSLog(#"current version: %#, appversion: %#", currentAppVersion, appVersion);
if ([currentAppVersion isEqualToString:appVersion] == NO) {
// Your app has just updated to new version, migrate your app settings.
} else {
// NO, do nothings with your app settings.
}
Hope it help your much, :)
The contents in Application Documents directory and Library directory will not change after app update. So what you should do is just write the settings (say a string "SWITCH:YES") to your Documents directory just like
[string writeToFile:<#(NSString *)#> atomically:<#(BOOL)#> encoding:<#(NSStringEncoding)#> error:<#(NSError **)#>];
see this post Retaining data after updating application
Your 1.1 version just needs to read the saved user settings written by the 1.0 version. This is one reason that putting a versioning mechanism in your saved user data is a good idea, to make this type of upgrade simple.
for sure you are saving your switch value some where on your first version so you can get it and apply it in the next version .. for me when I make update to an app I usually build a backward computability class inside it I retrieve all the user settings and content and call it for the first time the app run and then I apply the old settings on the new version. Good luck

iPhone app Update Vs new version

Let's say I have an existing IOS app live on Appstore which is version 1.0
Now I make some changes to the app and want to submit back.
Are there 2 separate ways to submit ?
Like can I still keep the version as 1.0 and just submit the app OR
I need to create a new version 1.1 and then submit it ?
What are the differences in the process?
Also from the customer end, how does this work for new/existing users ?
I have just discovered something about version upgrades and the App Store. Just now, I'm suffering issues and users crashes because of a behavior of iOS system that I can't figure before. And, very important, iTunes, AppStore and iOS have modified some upgrading and installing rules in last versions. Now, it works this way:
- When user install a new version, all the files in the bundle are downloaded and copied in the previous existing bundle, but OLD FILES OR COMPONENTS ARE NOT DELETED (or not all are deleted). So, the final bundle IS NOT equal to the bundle of a fresh installation of the new version.
- For example, if a xib/nib file is localized to different languages for the new version, the updated bundle will include both versions: the one in the root folder and the other one in each localized folder. The system, obviously, will use the first one and only a fresh installation will show localizations for that file.
One of my apps shows that issue with MainWindow.xib and as there are some modifications in references and classes, the updated apps crash each time you try to run as it is using a obsolet object. I have built a new version changing the name of the xib/nib files that have been localized. As MainWindow is one of them, I have to modify the reference in info.plist of course.
OK, knowing that, you can build a new version with complete different components in the bundle that, if files of previous version does exist, the app then offers the user the option of using them. That is, two versions of the app in a single icon and bundle. Not very difficult to do.
BUT, the very weird thing is that I think that new iOS version and iTunes don't allow downgrades. I have tried to do it but didn't get it done. That is, if you install a version, for example 1.2, it is impossible AFAIK to install latter v1.1 on the device nor in iTunes->"Applications". So, the double version bundle will live until a reinstallation of the app.
You need to create a new version number, which makes sense since this is a new version of your app. This will then appear as an update for your customers. I don't think you can upload a new binary with the same version without removing the old one from the store.
You add a new version in iTunes connect, then update the version number in Xcode to match and create a new archive. It's pretty straightforward.
You must always increase the version number of any update to your app.
Users will see a badge on the App Store icon on the device, and in iTunes on their PC. Going into the updates section, it will list your app along with the list of changes you've provided, and a button to install the update. They can also update all apps at once.
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:#"CFBundleVersion"];
NSLog(#"version is%#",version);
You do not have to open version numbers to submit any longer. Open up Xcode, go to Window - Organizer - Archives and Distribute an app you have created successfully.

iPhone sdk - owners name?

Is there a way in the iPhone sdk to get the name of the contact who own's the phone?
I see that my app has been cracked, and I would like to update a release which checks to see if it a cracked version and then display the following:
Hello (Persons name). I see you are using a cracked version of (Application Name). If you like this application, please support the me by purchasing it.
StackOverflow: Reducing Piracy of iPhone Applications
Like previous poster mentioned, you can't get the user's name. You can, however, get the phone number by doing
[[NSUserDefaults standardUserDefaults] objectForKey: #"SBFormattedPhoneNumber"]
Taken from here
Also regarding copy-protection: problem with iPhone app copy-protection is that Apple does not provide public docs for distribution format or anything even remotely related. So if you base your checks around those undocumented things, you are really juggling on a mine field. Ultimately Apple should really fix this broken system.
That's not available because that's a privacy issue.
(I know, there's some irony there, considering your user just cracked your app, but I digress...)
There's lots of discussion about anti-cracking measures. ArsTechnica has a story about one developer. Try Google or Apple's Dev Forums (thread).