iPhone: Start or Download App if not exists from Safari - iphone

I know its possible to open an app from mobile safari using custom URL Handlers.
Is it possible to open the App Store from Safari on the iPhone and automatically install the app?
Or might it even be possible to open the app if it exists on the users device and to download it if it doesn't?
Best,
heinrich

You can't automatically install the app, but you can go to an App Store URL via UIApplication's openURL: method.
To open another app from within yours, see this question: Launch an app from within another (iPhone). (I don't know how you'd find out if the other app is installed. Maybe just try to open it, and if that fails, open the App Store URL?)

Related

Is there a way to password protect the download of mac app from appstore?

In one of our project we have 2 binaries, one for iPhone and other for mac. These two application communicate each other to achieve the functionality. We want the user to download and install the iOS app first and then let him download the Mac application.
Is there a way to restrict the user, if the user try to download the mac app before downloading the iPhone app?
Short answer: If you're referring to the Mac App Store, then no.
Long answer: Both, the App Store and the Mac App Store give you no way to control who downloads your app and you are not able to get information about what a user already downloaded.
You could of course ask for an e-mail address in your iOS app and make sure your users register to a server before you e-mail them a link to a private download page (not the Mac App Store).
General advice: I think there is something wrong with the design of your app. It's not clear to me what you're trying to achieve and I bet your users won't either. If you want to make sure they pay for the iOS app before using the Mac app then just alert them in case they downloaded the Mac app first. You need to write some custom service to check for this of course. If there is some functional problem that requires the iOS app to be launched first then you should solve this yourself and not put that burden on the shoulders of your users.
You could allow anyone to download, but simply block any operation until the iOS app has sent some kind of approval token to a server or iCloud for example.
You have to download mac application first, and after downloading you can check if user downloaded iOS app or not, but before downloading you can't check the downloading state of iOS app, because application will upload on appStore not on your personal store.
After downloading iOS app set some flag value on server, and check this flag value on mac app downloading, it it is 1 then download else show alert.
After iOS app downloading -> Set flag value (ios Download=1) to your server.(make web service for this).
After downloading mac app -> Call you web service to check that flag value. if it is 0 then show alert to download iOS app first.

iTunes app link cannot open page in safari in simulator and also iDevices

I hope this may be duplicate question. But none of the answers didn't hard help me. I am trying to open a link from my iOS application. When I press the button, It opens the safari app and it always says an alert "Safari cannot open the page because the address is invalid". Here it is a link looks like the same https://itunes.apple.com/gb/app/app_name/id(appId) .
I don't think it is a good place to post the exact the app link. So the above link is dummy link exactly look like mine. Why the error always happening when I try to open the link. I tried in simulator and also in iPod. Same error occurs. If I try the same link with Safari in MAC OS then it works.
Here it is a code I am using to open the safari from my app with a link.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://itunes.apple.com/gb/app/app_name/id(appId)"]];
I am from India. The above link contains gb. Is that link can only open from Great Britain??
UPDATE:
I have good working network. And I tried one more thing. I opened my safari app in simulator and search my app in google and clicking that link shows the same error. Is that a problem with that link in apple side itself??
Kjuly's answer is 90% correct (and +1 to Kjuly!).
If you look at the at the Appirater code,
and in the .m file that has the function that opens up the app store (it's the "rateApp:" method) I see this bit of code:
+ (void)rateApp {
#if TARGET_IPHONE_SIMULATOR
NSLog(#"APPIRATER NOTE: iTunes App Store is not supported on the iOS simulator. Unable to open App Store page.");
#else
So no matter what you try, you are not going to be able to open the App Store app within the simulator. The App Store app does not exist in the simulator, so that's why you get a "not found" error when your web view attempts to redirect to it. This should work fine on the actual device that has the App Store app installed.
Take a try with this URL:
http://itunes.apple.com/app/<appId>
Note: Replace <appId> with your desire App's ID, e.g. id543028543.
That is a possibility as you are specifying the region to which the app belongs or is hosted on the app store under. Try loading the the url without the region 'gb'.
I was having same problem. Links in email not opening, links to App Store not working and App Store not searching or loading apps. I called Appke support. A reset worked! Go to settings to find how the reset under general. It doesn't delete anything either.

Autostart of an iphone app

I am building GPS Tracking app. I want the tracking functionality to be started
after a reboot of device. Now I did with background compatibility, It works fine on background, but I need to start tracking when the device is rebooted (switch on) without having to open the app to start the functionality.
How can I implement that. Please give me procedure for how to enable the autostart for
that app and how to invoke a method to start tracking.
If you watch the app like skype and webEx that are autostarted on iphone starts..
How these apps are working. I have no idea for enabling this autostart.
Please suggest me how to do?
Thanks in advance...
Add the UIBackgroundModes key to your app’s Info.plist file. Set the value of this key to an array that includes the voip string.
You can do that in xcode: Select your project root -> Capabilities -> Background Modes -> check 'Voice over IP'.
From the documentation:
"An app with this key is also relaunched in the background immediately after system boot".
No third party app can be launched on startup. Skype (and others) simple respond to push notifiactions
The only way to actually open an app from the user not explicitly opening it, is to call a [[UIApplication sharedApplication] openURL]; - or somehow otherwise open a URL, and you have to set your app up to have a custom URL scheme... see this page.
E.g: Doodle jump has URLs such as doodlejump://highscores - which you can open from an email from them or their website.

Launching iTunes Store within iPhone app using PhoneGap

When I use itms://.itunes.apple.com/us/album/speak-now/id399727924 it works fine in xcode.
But, I'm trying to use this in phonegap and external linking is not working.. is there a way to launch itunes within app.. ex: _webapp?
thanks,
jad
Yes,
iPhone will recognize an URL to the iTunes store and open it with the proper app.
try to open the following url using an iOS device: http://itunes.apple.com/au/album/speak-now-single/id396131841
On your URL, there is a dot (.) before itunes, maybe your problem is this.

Can we call one iphone app from another iphone app?

Say, that i am clicking on one iphone app icon,when launched it will create one .app file.So is it possible to call one more iphone app from that app.Or can we do something in that .app file such that it will call another app.
Yes: you need use URL Schemes:
Essentially, one app registers the fact that it handles a particular URL prefix, and then to launch that app, you have to navigate to that URL.
You can pass parameters through this URL too
If by calling another app, you mean to use other app as a service then No. One iPhone app can not communicate with another iPhone app.
The best you can do is launch another iPhone app from you app. You need to know the URL for that other app. If you want other apps to launch your app then you need to register a URL for your app so that other apps can launch your iphone app using that url.
Please note here the app will only launch if it is already installed on the iPhone. It will not automatically get it from iTunes.