TWRequest is deprecated in iOS 6.0 - what can I use instead?

Tobias Bambullis picture Tobias Bambullis · Nov 11, 2012 · Viewed 8.3k times · Source

I'm developing a Twitter Feed View for an iOS App. I found TWRequest and it works exactly like that which i was looking for. But: i get an Notice: "TWRequest is deprecated: first deprecated in iOS 6.0". What should I use instead?

Answer

Daniel picture Daniel · Nov 11, 2012

On iOS 6 you should use the Social.framework. This has a class named SLRequest.

You use it almost in the same way as the deprecated TWRequest, but you need to specify that it's a twitter request as opposed to a facebook request.

The entire Twitter.framework became deprecated as of iOS 6, since Apple added Facebook and Weibo (a Chinese social network) to iOS 6, they grouped all social classes into the new Social.framework.

Note you must specify the service type for Twitter/Facebook, Example:

SLRequest *aRequest  = [SLRequest requestForServiceType:SLServiceTypeTwitter
                                          requestMethod:SLRequestMethodPOST
                                                    URL:myurl
                                             parameters:myparams];

Be sure to check out the documentation.