problem with UIWebview and link to App Store - iphone

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).

Related

SLComposeViewController addURL issues iOS7

I have a standard facebook and twitter SLComposer that brings up a small saying and also attaches a link to the app on the message using the addURL: function. I'm testing it in iOS7 and whenever I brink up the composer I am immediately taken out of the app and to the attached link address (which in this case is the app store). It's only doing this in iOS7. 6 and under works just like before. Any Thoughts?
Try add image for share for preview of the url destination.
If SLComposeViewController doesn't have image for preview, it tries to get image from the URL of destination server.
In my project I've found redirection on server to AppStore from my server.
I'm seeing something similar, but only when adding URLs that redirect to the app store, such as bitly links. Regular links outside the App Store work just fine as do App Store links that are direct (e.g. do not redirect). Does this sound right? I think it's a bug in Apple's plumbing for catching loaded App Store URLs iOS wide...
The URL is fully loaded to generate the preview image that you see in the tweet/facebook. Reported as rdar://15228808.
The behavior of how the Social Framework works was changed in iOS 7. In iOS 6 my app would just show a dialog for posting to either Facebook or Twitter regardless of whether my device/simulator had an account setup with the respective service. In iOS 7 it will only show if I have an account setup. I think this is based on the method "isAvailableForServiceType:". Without seeing your code, I can't be sure this is your issue, but my guess is that it might be.

Cannot get back to my app after posting to facebook/twitter

I have developers working on the backend of my app using phonegap and once the user clicks facebook/twitter share a browser pops up and you can log in and share but after
that you cannot escape back to the app, if you get out of the apps altogether then try and return to my app you're right back at the facebook/twitter screen instead of in my app. This is only happening on iphon because on android they have a back button. The only way to get back into the app is to restart the iphone/ipod to get back to open
the app from beginning. I cannot have this as the only option for
people to share from my app as it would be horrible and could ruin my
app before I launch it. They say their is no way to fix it but Im sure its fixable so I am trying to get any info on this that I can.
The other issue is the facebook post itself. currently it post like this
Sent from Appname(with link to app)
www.appname
Text here
but this is kinda counter intuitive because the actual message should
be on top otherwise it will get lost in the other text. They said
this is the only way facebook allows it. Is it possible to get it like this
Text here
Sent from appname(linke here)
www.appname.com
Again any help on these two issues would be great so I can pass the
info to my developers.

Launching an iphone app from custom URL in sms

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.

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.