To update ios app when newer version is available - iphone

I am totally new to ios development.
I have an ios7 and ios8 app which do polling to Server to check for latest version.
Once the latest version of app is available I am opening Alert Box(Notification) for user to update App.
Now, once user click on Update Button, Which API I need to use to get latest version of App from Apple App Store or Web Store.
And how can I move the user's saved preferences to new App.
Will be helpful If some one can put code sample to do so.

I don't believe there's an API which you can call to update the app. The only option available is to send the user to the App Store page for your app where they will see the update button.
As far as preferences go if you're storing them in NSUserDefaults or as a plist then they should persist unless the user deletes the application from the device.

I found the solution to my problem.
Every App has a unique url in the App Store.
Lets assume you have updated your app from version 1.1 to 1.2 and releases app in app store.
Now in the application after checking your app version you can use openURL method to redirect to the url of App in app Store
e.g.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"AppURL-String"]];

Related

Safari App takes user to Settings App in iPhone in iOS 6. How can this be done in my iPhone app?

I had a requirement to redirect a user to the iOS Settings application from within my application. I know that in iOS 5, we could use the following URL scheme to achieve this: prefs:root=General.
And I could use the following line of code:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General"]]
But Apple no longer supports this open URL scheme since the iOS 5.1 update.
But recently I have noticed that, in the Appstore app and Safari browser etc, Apple let this happen.Please refer to the attached image where Apple shows the alert. And on clicking the Settings button, user is taken to the Settings app. Any idea, how this is done. I believe if this can be done in App Store application, there should be some way that I can do it in my application also. Please comment if someone has a fix, or more idea on how this can be done.

Notify User about new update of application in app store as a alert and automatically install updated version in iPhone?

Currently my application with version 1.1 is available in app store.
Current Scenario: when i update new version update is shown in app store when user goes to app store.
Required: As soon as user starts application alert should be popped up and if new version is available in app store it should automatically install that if user clicks OK.
Please suggest me the way to do this.
You can't make it install automatically, you can send the user to the app store app with your itunes app url.
Also you will need to make you're own webservice to check if a new version is available.

how to avoid twitter already authorized on the device using share kit in iphone sdk

I used sharekit for twitter integration in my app. That works fine on the simulator. But on the device , for the first time it allows me to login into the twitter . Now i deleted the app from the device and create new build and deploy that into device again. Now it shows already authorized for twitter , not able to login even i deploy the new build on the device
Any ideas..to avoid this.
Thanks in advance..
The data for Sharekit's Twitter implementation are stored in the user's keychain when you run on the device. Because of this, deleting the app will not delete the token for Twitter stored in the keychain by Sharekit. When you delete and reinstall the app, it's still reading from the keychain and picking up the old credentials. You need to implement the logout functionality. The implementation is pretty simple. You just call
[SHKTwitter logout];
Check out the ShareKit documentation for details and options.

iphone application update

i would like to check:
if a user downloaded my app, than i make some update to app, data etc., itunes will auto remind the user of the update through app store, and the user can update for free? or do i have to set such reminder in my application?
else, is there a way for me to send this notification?
thks
Rgds
Yes, the phone notifies of app updates through the App Store app and app updates are free.
Alternatively, you can use push notifications to notify the user that a new version is available, or display an alert the next time they open the app.
To do the latter you can query the version of the app ([[NSBundle mainBundle] objectForInfoDictionaryKey:#"CFBundleVersion"];) and compare it to a value provided by your web server.

is there a way to automatically update iPhone apps?

I am looking for some way to automatically launch the app store on an iPhone from within an app. For example, the user logs in using the app, and the server requires a specific version of the app. Can I open the app store, or grab the upgrade automatically, or does the user need to go through the app store manually?
Thanks in advance,
Conrad
The user needs to go through the AppStore to get the upgrade. The user might choose not to upgrade the app for whatever reason and you can't force update.
Of course, you can navigate to the AppStore page and offer the choice to the user.
Have you tried [[UIApplication sharedApplication] openURL:#"itms://..."] with the URL for your app?