Launching an iphone app from custom URL in sms - iphone

I have a problem with launching my app from an url in an sms.
When I open my Safari and type "myapp://" it opens my application, but somehow the iPhone sms parser can't recognize my url in the body of the message.
I tried:
myapp://something
myapp:something
<myapp://something>
and still the URL in sms message is not clickable.
I have configured the URL identifier and scheme (because it works through safari).

My solution (not a good one) would be to send the user to Safari with a original http:// address and redirect the user to my app-url. This only requires simple HTML-Knowledge (and a webhost).
http://myapp.info/?id=myuniqueidfortheuser
The downside with this is that you must go through Safari to open the app.
This is the only solution I can think of with these restrictions by Apple.
I really hope they can fix this in the future.
Best of luck to you and I hope you'll solve this problem.

Related

Open my iPhone app from the url received in sms

I want to launch my application from the url received to user via an sms.
How do I achieve it?
The format of my url is:
https://companyname.net/productname/?some_parameters_for_user
I want to prompt user to open url in safari or my app and depending on his choice, the app will be launched either in safari or directly the native app.
The url opens in safari but how to invoke native app? and take user to a particular page in app?
Please help.
Thanks in advance.
Look at the custom URL scheme. It's described in several places. Here is a link to "Advanced App Tricks"
It's described there, along with many other helpful ideas.

Custom URL scheme does not work sometimes in iPhone

I have an application where I have to get a message from server. The server sends the message in an SMS. Since iPhone applications cannot receive SMS programatically I have registered a Custom URL scheme and prefixing my message with the custom URL value say for ex: mymsg://.
This works fine most of the time. Whenever the SMS is received by the phone and I click reply button, it takes me to the reply state and the original message will appear like a link which I can click which takes me to the application. For some reason, sometimes this message is not clickable. That is, when I click on the message it does not launch the application or simply the message is not clickable. Then if i restart the phone, the link is clickable again and i can click on the link which launches my application. Does anyone know what could be the reason?
-chinnadurai
I've encountered this issue before but I'm not sure it's the same one you're having. What I discovered is that whether or not a custom URL scheme is clickable in Messages.app is determined when the message arrives, not when the user sees the URL.
What this means is that if you send the user your custom scheme URL before they've downloaded the app, that link will never be clickable, even if they go on to download the app at a later time. I've verified this behavior on iOS 7.1 only (haven't checked other versions).
For my case, I can't guarantee that the user has already downloaded the app when I send the message, so my solution was to use a standard http:// url that redirects to the custom myapp:// URL on the server with a 302 redirect. Hope this helps!

Catching an exception when trying to launch a URL service from within Safari on an iPhone

I was wondering if anyone knows - if I have an iPhone app that is registered with a URL service (e.g. alocola://), which means another app can invoke it by calling its URL - is there any way to embed this URL in an HTML page, and catch the exception if the app is not installed on the user's iPhone?
Or in other words / more details:
I would like to write an app that conforms to some URL invocation (like alocola:// is doing), but would like this app to be launched from a web page read by mobile Safari. However, if the app is not installed on the user's iphone, I would like to be able to display a note saying "you must have the alocola app installed on your iPhone, please download it from the app store by clicking here". Is there a way (perhaps using javascript) to have Safari indicate that the URL cannot be invoked, and catch this in order to display an intelligent message?
Thanks :-)
Ariel
No, there's no way to detect this and display such a message. Instead, you should put text on the webpage saying that the using the link requires your app.

iPhone: Pass information from web page to app that's downloaded from App Store

I'm trying to glue information from a web page to an iPhone app that said web page suggests to download. I control both the web page and the downloadable app.
Scenario is like this:
User visits my web page, on which I recognize the user (he may have logged in, and I store his info in a cookie). I then present a link to him to an app in the App Store that he should download for "enhanced experience" of this web service of mine.
Now, when the user launches the downloaded app on his iPhone, I like to re-identify the user who previously visited said web page.
All would be easy if an iPhone app could read Safari's cookies. But it can't.
A somewhat lame solution could be that the web server stores the visitor's IP address and uses that to recognize him once he launches the iPhone app. But that's not reliable.
Another one would be to give the user a token (code) that he needs to remember and then re-enter in the app. Still quite awkward, I think.
Any better suggestions?
Simply put, you can't do this.
One thing you could consider is a custom URL scheme to launch the app. You could send the user an email that uses this custom link. However there's a couple of problems with this:
the user may not have the account that they used to register for your site set up on their iPhone. This might seem unlikely, but say the user signed up for your site 5 years ago with their Hotmail account and they have since switched to Gmail.
it's unlikely that the email would fit into their workflow. They would probably download the app and just launch it by touching the icon instead of clicking a link in a received email.
You could also put the custom URL as a link on your web page, but again, this won't fit into the workflow because they have to go to the App Store app to do the download.
Consider this - if you've got some sort of website that has an authentication step, it's probably a fair bet to say that the user is the type of person who already has an application such as Facebook installed on their iPhone. They are already used to the paradigm of having to enter their credentials into an application despite the fact that they may have already done it in Safari.
If you could read the unique iPhone device ID from javascript on your web page, you could look for that again when the application connected...
But I cannot find any means of reading this from Javascript in Mobile Safari, I thought I'd post in case there is a way now to give you another option to consider.
OK, we found a somewhat working solution: The html code can create a cookie. Later, when the app runs, it can't directly read that cookie, of course (due to the sandboxing of iPhone apps). However, it can connect to the server, then open a http URL pointing to the server and including a unique token that it has gotten from the server beforehand. This leads to launching Safari, accessing the server. The server can now read the aforementioned cookie and finally establish the connection with the help of the token.
Just stumbled over this question and I'm curious if you thought about using a UIWebView.
Where the question is - does UIWebView share cookies with safari?
If it does the rest should be easy.
UIWebView's DON'T share cookies with Safari. So unfortunately that is not an option.

problem with UIWebview and link to App Store

In my iPhone application I have a UIWebview that shows an html page. Inside that page there are links that should lead the user to the iTunes application and the application they tapped on. However, when the user taps on the link it errors out with 'too many redirects'. Looking at it with a packet sniffer I see it just keeps redirecting to the same http://phobos.apple.com/... URL. I even tried changing the link scheme to 'itms://' but that results in a 'Cannot show URL' error. I could solve this problem by trapping the URLRequest and sending openURL: to the UIApplication but the app has already been deployed and I don't want to patch it. I rather do it on the html/js/server side if possible. Anyone have any ideas?
For anyone still searching for this answer, I found that it seems to be a problem on the simulator which doesn't support itms:// URLs (because there's no App Store app). I didn't see the same issue on hardware, where the App Store app opens just fine (in my case this was when testing URLs from AdMob adverts, but it's probably the same for UIWebView).