How could Twitter know the source of TWRequest? - ios

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.

Related

How to send Tweet via your iOS App (NOT Twitter)

In my application I need to generate a link and needs to share on Twitter and Facebook. For Facebook I have used its SDK but for Twitter I am not able to find any such SDK which I can integrate in my app and make it able to Tweet it.
On Twitter site I saw REST API but I think that cannot be used for Tweeting. One more thing, I have integrated the Twitter with the help of Social.framework but in case if user hasn't provided his/her details in iPhone then that code won't work and I think if Twitter App is installed in the iPhone we can just launch the app but I cannot pass Data to be Tweeted.
How would you have handled this situation?
http://wiki.akosma.com/IPhone_URL_Schemes#Twitter
Try using one of these URIs. You need to handle the case where the user does not have the app installed also. For that I believe you will want to launch the browser and send a web intent.

Integrating twitter login in IOS

In my IOS app i Want to add twitter login in order to fetch the user's information like Name, Email ID and Profile picture.Can anyone please provide me some useful information or some tutorial link that can help in integrating twitter login in my app and to fetch user information.
If you're just trying to do some really simple login stuff and are new to iOS, I would definitely check out Parse's Twitter Login tools.
https://parse.com/docs/ios_guide#twitterusers/iOS
Really user friendly and simple to get the hang of.
If you want to add twitter login to your app in a simple way, I would recommend you to use Fabric framework. Follow this link: https://dev.twitter.com/fabric/ios
Note: You can't bring user's email easily. You need to get permissions from twitter by filling a form in twitter website or else by sending email to fabric team.
Twitter Kit provides all the required functionalities and mechanism for making authenticated requests to Twitter's REST API.
Follow the configuration process here.
Using TWTRSession, you can request for TWTRUser object and that will have what you need.
This is the right way and advisable one too.

iOS upgrade to twitter api 1.1

I currently have a bunch of apps that go and make simple anonymous calls to the twitter API, and grab several differing timelines. Obviously, twitter is changing things up with 1.1, and is demanding authenticated calls using oauth. Does that mean each of my users need a token (their own account) to do call, or do I need one app token for all of them? Should I be using the twitter api included with iOS 5? Note: These are not the user's timeline...just several news feeds on twitter. Am a bit confused. Any pointers would be appreciated.
This is a good question, I struggled with this myself.
You can use Twitter API client via PHP and then json_encode the user timeline you want and parse it. This is not the best practice, but is a work around I had to do for an app on which I wanted to only display tweets no other action was need, like getting links, retweets, etc.
hope this serves.

Session timeout error with Twitter OAuth flow using ShareKit on iOS

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.

How can I sign tweets containing my custom "via" with the iOS 5 Twitter framework?

As you probably know Apple released a Twitter framework with iOS 5. It provides a class called
TWRequest which allows you to make HTTP calls to the Twitter API. The accountsd process takes care of all the OAuth signing.
If you make such a TWRequest your tweets shows up as "via iOS". Is there a way to embed my client specific information to don't lose this identification?
Looks like you can't actually set this.
According to: https://dev.twitter.com/issues/39
They match based on the app name in Apple's database. You can't already have a registered Twitter Application with the same name.
Also, seems that you can't get this to work with AdHocs or test apps, only published apps.

Resources