I'm working on an URL shortener that keeps track of how many times a link was clicked.
However, I'm running into a problem where both Twitter and Facebook will access the URL a few times once it is published. Twitter opens it 6 times, and Facebook only twice.
How can I know when they're the ones following through the URL so I can avoid counting their accesses?
Thanks in advance.
You can try detecting the User-Agent HTTP header if the request are made from facebook or twitter bots it should be different.
Related
I've tried to create a dynamic links with branch.io to redirect to my mobile app but i encounter some issues : The tweet is not visible neither in general feed nor in notifications mention of the target user. However when i tweet with a normal url it's okay no problem.
Any solution ?
That's very strange! What's the Branch link URL you're sharing on Twitter?
I'm trying to figure out how to post from xcode to a specific user's timeline. I found a lot of posts but they seemed to be for older versions of the facebook sdk.
I'm looking here:
https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.4
And the only option I'm seeing is to use url redirection.
I'm looking here for options here:
https://developers.facebook.com/docs/sharing/ios
But I'm not seeing any way to specify it to post to a different user's timeline.
So is the url redirection the only way to do it? What I want to do is press a button on my ios app, and then have it post to a facebook wall. If I use url redirection, it will open up a browser... do the posting and then redirect somewhere... where I assume I will have javascript code to close the browser.
Are there any other options? Thanks.
You can only post to the timeline of the logged in user. Posting to the timeline of one or more friends of the user is not supported.
I have made an iOS application which connects to Facebook via OAuth 2.0. I have one problem, no matter how much I search through the Facebook API docs, I can't find the request URL for a users News Feed (the feed which appears on the Facebook home page for each user).
I found this URL:
https://graph.facebook.com/ID/feed?
But the above URL only shows the posts that the particular user has made.... thats not good enough. Whats the URL which shows all the posts the user is following (so their own posts, pages posts, friend posts, the lot).
Thanks, Dan.
I'm just curious. TWRequests use generic ACAccounts which are shared by all apps on iOS. Apps don't specify their own consumer_keys. So how could Twitter know which app a specific TWRequest come from?
Twitter can't tell which app a specific TWRequest comes from.
Accounts.framework embeds consumer_key and consumer_secret.
For Twitter, all requests just seem to be coming from iOS Twitter integration.
Query params adc=phone and application_id=your_iosapp_sig (i think) are added to each request url during the OAuth process. Twitter should be able to identify your app by the application_id
Once you build your TWRequest, you can see the url request by
NSLog(#"%#", request.signedURLRequest.URL.absoluteString);
This should reveal the above two params.
I am using ShareKit to allow the user of an iPad application to Tweet a URL from within the application through their Twitter account. The following OAuth steps work fine:
ShareKit uses the Consumer Key and Consumer Secret hard-coded in the app to request the URL to load in a WebView.
The URL provided by Twitter displays correctly in the WebView.
The user is prompted to grant Read and Write permissions by logging into their Twitter account using the WebView.
The WebView shows a redirecting page briefly while it redirects to the callback URL.
At this stage in the OAuth flow things go wrong.
After the WebView displays a Twitter 'redirecting' message very briefly, a page saying 'Your session has timed out' is displayed.
I decided to create a Twitter application in my own personal Twitter account. When I change the app to use my own Consumer Key and Consumer Secret (but keeping the callback URL and permissions the same), everything works fine.
I have cross checked the Consumer Key and Secret with the values in the app and they match (for the Twitter account that failed).
I used Twurl and everything worked fine with both Twitter accounts. So I don't understand what could be wrong with only one of the Twitter accounts and only when using ShareKit.
I could do with some direction on how to track down the problem?
I can not help you directly but original share kit is obsolete in many ways. You might want to try ShareKit 2.0. At least, on ios5+ it uses Twitter.framework, so your problems might be gone.