अद्यतन: ट्विटर द्वारा फैब्रिक में ट्विटरकिट काफी आसान है और यदि आप अपने ऐप में ट्वीट करने का प्रयास करते हैं तो अपने ट्विटर ऐप से पोस्ट करना है, तो यह विचार करने का एक अच्छा विकल्प हो सकता है।
(हाँ, यह विधि आपको किसी भी संवाद बॉक्स या पुष्टि के बिना ट्विटर पर पोस्ट करने की अनुमति देगी)।
ट्विटरकिट अनुमति भाग को संभालेगा और TWTRAPICLient का उपयोग करके हम ट्विटर बाकी एपीआई के माध्यम से ट्वीट करेंगे।
//Needs to performed once in order to get permissions from the user to post via your twitter app.
[[Twitter sharedInstance]logInWithCompletion:^(TWTRSession *session, NSError *error) {
//Session details can be obtained here
//Get an instance of the TWTRAPIClient from the Twitter shared instance. (This is created using the credentials which was used to initialize twitter, the first time)
TWTRAPIClient *client = [[Twitter sharedInstance]APIClient];
//Build the request that you want to launch using the API and the text to be tweeted.
NSURLRequest *tweetRequest = [client URLRequestWithMethod:@"POST" URL:@"https://api.twitter.com/1.1/statuses/update.json" parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"TEXT TO BE TWEETED", @"status", nil] error:&error];
//Perform this whenever you need to perform the tweet (REST API call)
[client sendTwitterRequest:tweetRequest completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
//Check for the response and update UI according if necessary.
}];
}];
उम्मीद है कि इससे मदद मिलती है।
स्रोत
2015-02-19 09:29:44
बहुत दोस्त धन्यवाद। – sooper
@Sooper कोई समस्या नहीं –
कोई छवि जोड़ने के बारे में क्या? –