My question is what can I do to convert the custom URL scheme to a QR code that can open an app.
Let's say I have a custom URL (myScheme://). It works if I type it on my phone's browser.
But if I just convert it through some online qr code generator, the qr code reader is not going to open the url in browser and just return me a plain text.
Does it mean I need to build an own QR code reader to handle it?
I think it depends on QR Code Reader apps. In my situation I have a custom URL (itms-services://?action=download-manifest&url=xxx) QR Reader for iPhone works. But some customers said: "I can't install the app. QR just opens Safari.". There are so many QR Reader apps and we don't know which one is used.
But you can use your own web-site something like this:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0, maximum-scale=1.0" />
<title>Site Name</title>
<style>#media screen and (max-device-width:480px){body{-webkit-text-size-adjust:none}}</style>
<!-- implement javascript on web page that first first tries to open the deep link
1. if user has app installed, then they would be redirected to open the app to specified screen
2. if user doesn't have app installed, then their browser wouldn't recognize the URL scheme
and app wouldn't open since it's not installed. In 1 second (1000 milliseconds) user is redirected
to download app from app store.
-->
<script>
window.onload = function() {
<!-- Deep link URL for existing users with app already installed on their device -->
window.location = 'yourapp://app.com/?screen=xxxxx';
<!-- Download URL (MAT link) for new users to download the app -->
setTimeout("window.location = 'http://hastrk.com/serve?action=click&publisher_id=1&site_id=2';", 1000);
}
</script>
</head>
<body>
<!-- button to Download App for new app users -->
<form action="http://hastrk.com/serve?action=click&publisher_id=1&site_id=2" target="_blank">
<input type="submit" value="Download" />
</form>
<!-- button to Open App to specific screen for existing app users -->
<form action="yourapp://app.com/?screen=xxxxx" target="_blank">
<input type="submit" value="Open App" />
</form>
</body>
</html>
Then you should generate QR with website url. It will open in Safari and will redirect your app. (I hope so.)
Related
I am trying to realize App Invite feature for iOS app. All works good except custome URL Scheme with parameter (like referral).
iOS app has two URL Schemas:
fb123456789712345://
myappurlscheme://
Meta tags in web server:
<meta property="al:ios:url" content="myappurlscheme://fb_app_invite?referral=referralname" />
<meta property="al:ios:app_store_id" content="123456789" />
<meta property="al:ios:app_name" content="MyApp" />
<meta property="al:web:should_fallback" content="false" />
<meta property="fb:app_id" content="123456789712345"/>
When FB user clicks on the App Invite from their profile i'am expecting than iOS app will be open with URL(myappurlscheme://fb_app_invite?referral=referralname),
but in practice i get URL(fb123456789712345://authorize#access_token=ZXZXZXZXZXZXZXZXZXZXZX&expires_in=86400&target_url=%2Fappcenter%2$454545454545454%3Frequest_ids%3D3333333333333%26ref%3Dapp_invite_inbox%26content%3Dinvite%222222222222222222)
I dont know how to figure out to use custome URL Schema for parse referralname. Please, help me. Where i had mistaken?
Why is one metarefresh to YouTube failing while another is succeeding? And why does it have anything to do with whether Youtube as an app is installed?
We have two metarefresh links that take users to videos from an iOS app.
(1) This page refers properly to Youtube whether the Youtube iOS app is on your device or not:
The invoking link is: http://ourURL/videos/ourpage.html
The receiving HTML page is this:
<!doctype html>
<html>
<head>
<meta http-equiv="Refresh" content="0; url=http://youtu.be/tJ08IHetnbU" />
</head>
<body>
</body>
</html>
(2) The referral page that breaks is designed the same way but works only if the Youtube app is NOT on your iOS device. If the Youtube app is on your device, we see "Playback error. Tap to retry." "Error loading Tap to retry"
The invoking link is: http://ourURL.com/videos/ourpage2.html
<!doctype html>
<html>
<head>
<meta http-equiv="Refresh" content="0; url=http://youtu.be/0FZbh-Cqfg4" />
</head>
<body>
</body>
</html>
The answer turned out to be a caching issue in the YouTube app.
It appears the Youtube app relies on the Safari cache. The Meta-refresh had referred to different video links before - so the new updated links failed.
Interestingly, for whatever reason, Safari is not using its cache and showed the proper video.
After going to Settings, Safari and "Clear cookies and data" - the YouTube App started showing the referral pages properly again.
Should the stream action via SC API / Javascript SDK 2.0.0 work on iOS/Safari?
I'm finding that it doesn't with the trivial example below.
It seems like SoundManager is capable of knowing how & when to use html5. Am I mistaken?
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>Sound Cloud iOS test</h1>
<script src="//connect.soundcloud.com/sdk-2.0.0.js"></script>
<script type="text/javascript">
SC.initialize({
client_id: "YOUR_CLIENT_ID"
});
SC.stream(
'/tracks/293',
function(sound) {
sound.play()
}
);
</script>
</body>
</html>
You cannot force play or download any audio/video files in Safari on iOS devices without user initiation.
In Safari on iOS (for all devices, including iPad), where the user may
be on a cellular network and be charged per data unit, preload and
autoplay are disabled. No data is loaded until the user initiates it.
This means the JavaScript play() and load() methods are also inactive
until the user initiates playback, unless the play() or load() method
is triggered by user action. In other words, a user-initiated Play
button works, but an onLoad="play()" event does not.
This plays the movie: <input type="button" value="Play" onclick="document.myMovie.play()">
This does nothing on iOS: <body onload="document.myMovie.play()">
You will need to wrap your play action into a button, so that the audio stream is opt-in rather than automatic.
Check this article in the Safari docs for reference.
I've double checked everything, from my understanding this is all I need to do:
self.inviteContent = [[FBSDKAppInviteContent alloc] initWithAppLinkURL:[NSURL URLWithString:#"http://mywebsite.com"]];
[FBSDKAppInviteDialog showWithContent:self.inviteContent delegate:self];
On mywebsite.com I have this in the heading (example values shown here):
<html>
<head>
<title>My Website</title>
<meta property="al:ios:url" content="appurl://action">
<meta property="al:ios:app_store_id" content="1234567">
<meta property="al:ios:app_name" content="My App">
</head>
<body>
...
</body>
</html>
So the dialog switches over the to the latest Facebook iOS app. I write a message and pick the person I want to send the invite to, hit send and I get this error:
Missing App Link URL
The app link used with this invite does not contain an Android or iOS URL. Developers are required to enter a URL for at least one platform.
What am I doing wrong?
My app handles the custom URL fine because if I enter appurl://action in Mobile Safari it opens my app up.
You need to create an AppLink URL from here/
Choose your application from the list
Fill up the form with equivalent information
Click on Next !
You're done.
Now, you can use that link with your code for invite.
self.inviteContent = [[FBSDKAppInviteContent alloc] initWithAppLinkURL:[NSURL URLWithString:APP_LINK_HERE]];
[FBSDKAppInviteDialog showWithContent:self.inviteContent delegate:self];
The format of that link will be something like https://fb.me/xxxxxxxxxxxxxxxx
All xs will be replace by a digit.
Try to add also og:title and og:type properties, it works for me
<meta property="og:title" content="My App" />
<meta property="og:type" content="website" />
Adding meta tags would solve this, this is snippet of html from app link created via FB. Fb is adding some extra meta tags on it's app link url page, and it also redirects direct to itunes if opened on a browser.
<html>
<head>
<title>app name</title>
<meta property="fb:app_id" content="your fb app id" />
<meta property="al:ios:url" content="Your app link url" />
<meta property="al:ios:app_name" content="your app name" />
<meta property="al:ios:app_store_id" content="your app id" />
<meta property="al:web:should_fallback" content="false" />
<meta http-equiv="refresh" content="0;url=https://itunes.apple.com/WebObjects/MZStore.woa/wa/redirectToContent?id=your app store id" />
</head>
<body>
Redirecting...
</body>
</html>
I have an app that allows a user to install a configuration profile. I'm doing this by presenting a button on a view controller that when clicked, displays a very basic HTML page (using Cocoa HTTP Server) that has an iframe which will open the .mobileconfig file and allow the user to install it. After the user installs the profile (or indeed, cancels installation) iOS automatically switches the user back to the safari app. I've setup custom URL schemes and that works perfectly.
What I'd like to do is automatically redirect the user back to the app after they've installed the profile. I thought the best way to go about this is the http-equiv="refresh" meta tag but it seems it'll only redirect the user if they complete setup in under the refresh time (if that makes sense).
For example, if I'm able to install the profile and be switched back to safari in 3 seconds - it works. If I take 5 seconds or more to install the profile I won't be redirected. It seems like the meta refresh timer is running in the background and if Safari isn't in the foreground - it won't do it.
My question is then how do I automatically redirect the user back to my app once the profile is installed regardless of how long it takes them? I've had a look at using javascript but as you can turn that off in iPhones I'd rather not use it.
Index.html
<html>
<head>
<meta http-equiv="refresh" content="4;url=myapp://">
<meta http-equiv="content-type" content="application/x-apple-aspen-config; charset=UTF-8">
<title>Profile Installer</title>
<style>
#main{
font-family: "Helvetica";
padding-top: 500px;
padding-left: 80px;
padding-right: 50px;
}
p{
font-size: 27pt;
color: #FFFFFF;
}
</style>
</head>
<body bgcolor="#74caf2">
<div id="main">
<p>Downloading configuration profile. Please wait.</p>
</div>
<iframe width="1" height="1" frameborder="0" src="settings.mobileconfig"></iframe>
</body>
</html>
This simple JS is great to add to your code, it eliminates the problems that you mentioned with the content-refresh option in html. I understand that some users do switch off the JS in the mobileSafari but in my experience and some stats we gather from app I develop, that is 0.001% of all users.
<script type="text/javascript">
function Redirect()
{
window.location="urlScheme://";
}
setTimeout('Redirect()', 2000);
</script>