Link on Facebook with custom prefix/protocol (like myapp://blahblah) - ios

I added to my iOS application option to detect and response to custom URL schemes to launch application ( http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html ).
Link is working perfectly on different sites (using href), but I'm having problem with Facebook. If I'm trying to post link (using Graph API) which looks like:
myapp://blabla
Facebook return error:
The url you supplied is invalid
And for feed with link return
link URL is not properly formatted.
I can't just post url as a message because it's not being detected as a URL and appear like text only.
Is there any way to post to Facebook wall with custom links?
Edit:
I have an idea, but I don't know if it gonna work. Putting
myapp://blabla directly into address field in mobile browser is launching application so probably accessing an webpage (like http://www.mywebpage/myapp) with only redirection to
myapp://blabla gonna work too, but is Facebook gonna accept that link?

I think your suggestion in the edit is the correct method, and should work. However applications like spotify seem to use an intersticial page which fires the "app link" with javascript, the advantage to this approach is that you can use that page to "sell" the app to users who don't have it and also provide lovely open graph tags for people who want to share it.

Related

swift - Fetching OpenGraph meta tags from URL

I'm trying to fetch og (OpenGraph) tags from a URL and display in the app. I get the tags properly for most of the websites, but for some, I don't.
ex. This URL
When I render it on the browser and inspect, it shows me the meta tags, but when I try to fetch the html via cURL, it returns a html content without any meta. But, when I share the URL in Slack or FB, it renders the preview with the OG tags.
How do I do it on iOS?
Any help is appreciated.
The problem with the URL you shared is that the site requires Javascript to be enabled.
If you don't have Javascript enabled, you just get back a basic page saying that you need to have Javascript enabled to browse the site (hence, no Open Graph tags).
Your browser, Slack and Facebook execute Javascript but cURL does not. Neither will a URLSession in iOS.
In iOS, the only way you're going to be able to get access to the HTML for such a website is to use a WKWebView to render the page.
Then, when it's loaded, execute some Javascript using evaluateJavascript(_:completionHandler:) to get the OG tags.
That's the only workable solution for these cases using iOS libraries.
The iOS client for Facebook, LinkedIn etc do not do this on their iOS client. Their iOS client calls their backend, passing the URL for processing, and receives back the preview. Javascript is executed as part of this backend process.
There are public APIs around that will help you to do the same thing, such as:
https://opengraph.io

Typo3: FE Login with POST Request to external app server

I recently started getting into Typo3 but now I have to implement something for work and I have no clue where to start.
The requirements:
I have to add a separate page that can only be accessed by frontend
users. (so far no problem)
These frontend users should be able to login with the same password
as they got for their iOS app. (uh-oh)
The separate page should display data from the app. (less of an uh-oh
but connected to the previous point)
After talking to the developer of the app, he made a specific POST request that can be used for the webpage. I am also getting a json-file with the required data that I need to display upon successful login.
My question lies with the login. How do I go about implementing this? I use the extension felogin to provide the login form on the page.
The POST request is looking sort of like this:
https://domain.at/api/queryMediaItems. It needs user and password, declared as user and pwd. In the body there should be a json object with the language, e.g.:
{"language":"de-at"}
You need to implement a SSO (SingleSignOn) as your users need to identify against the iOS-app.
This might give you a concept.
You also can look inside the code of some extension

Twitter web intent not prepending # sign to `via` parameter

I am using a simple Twitter web intent (hyperlink) from a mobile-focused website that is intended to allow the visitor to compose a tweet pointing back to a page on my site. The intent is populated with various parameters, including a via parameter that holds a Twitter handle:
https://twitter.com/intent/tweet?url=...&via=MyTwitterHandle
When the link is clicked on most platforms, it opens twitter.com in the browser, and everything works as expected. The Twitter compose dialog opens with all of the information from the link prepopulated.
However, on iOS 9 devices that have Twitter installed, something's wrong. As expected with Universal Links, the native Twitter app handles the click. But when it loads, the via parameter (which holds my Twitter username) is populated without the # sign prepended. The native compose dialog looks something like this:
Because the # character is not prepended, Twitter doesn't recognize it as a username.
I've found two mentions of this problem on Twitter's developer site, but no solutions.
While contrary to the documentation for the Tweet Intent, I've tried including the # sign in the via parameter itself, but that results in ## in the very common case where the mobile web Twitter interface is used.
What other solutions do I have for a very simple Tweet intent that includes the via parameter and works across all major mobile platforms?
Not really an answer but I just tried and it seems like the problem is fixed as of 17th March 2016!

Custom link in an open graph story

I'm building a facebook app which uses open graph to publish stories. I can successfully publish the stories but what I want to do is to customize the app link in the story(circled in the given image).
Currently my link to "posted via APP_NAME" is referring to the Facebook appcenter page of my app. All I want to do is to customize the link and make it refer to my personal website. How can I do that?
Do I have to specify any extra parameters while making a POST request to facebook??
As far as I know this link leads to one of:
Canvas URL if you have a canvas app
Site URL if you have no canvas app just website with fb login
You can set both in App Settings (https://developers.facebook.com/apps/)
Looking through the logs it's impossible to distinguish it from people just accessing the app.
Add a canvas application with an address of page with this code:
<script>top.location.href = 'http://your-website.com'</script>

custom url schemes in twitter posts it does not work

I am an ios app developer. We have implemented a custom URL scheme 'my_app://section_name' or so where if the link is opened in the user's mobile browser, it will redirect the user to a specific section in the app.
We would like to be able to tweet these URLs and have users on their mobile device click on them to open up the app, however it just can click once
(when you click close , maybe you click wrong then you want to click it second but it does not work )
I hope this isn't too silly of a question. Thanks
Make sure to check the tweet body after it have been posted.
This may be due of an URL shortener, especially if the tweet is posted from the iOS 5 Twitter framework.
I'm having a similar issue with url schemes. We can include them in emails and text messages, and they highlight and work properly.
Unfortunately, when we do the same with a tweet, the iOS Twitter client fails to recognise the special URL scheme and so the user cannot tap on it to open our app.
Pretty big oversight, methinks. Anyone else had any joy including special URL scheme links in tweets?
A solution that you should consider involves not sharing the URI scheme directly, but rather creating a page on your web server to handle this. In fact, if you want to be able to share full URI schemes with paths, you're better off building a web server to dynamically generate a page with a URI scheme redirect.
This is a over-simplified representation of what we built at Branch. This includes some code to get you started though the web server will require a bit of setup not described here.
instead of testapp://some.data.here, you'll link to http://yoursite.com/hosted-redirect/some.data.here.
your server should listen at the route /hosted-redirect, grab some.data.here and build the following page (body here):
(source: derrrick.com)
So your server will have to generate and respond with this page, filling in some.data.here, anytime http://yoursite.com/hosted-redirect/some.data.here is requested.
A lightweight node app could do this with a single file.

Resources