Compose a Twitter DM without displaying dialog - ios

I see #Cirrostratus answer at
iOS 5 Twitter Framework: Tweeting without user input and confirmation (modal view controller) and it works nicely for a tweet. How would I alter this to send a DM instead?

Got it:
NSString *dmString = #"d #RecipientTwitterName ";
NSString *statusString = [dmString stringByAppendingString:stringForTweet];
postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:#"http://api.twitter.com/1/statuses/update.json"]
parameters:[NSDictionary dictionaryWithObject:statusString forKey:#"status"]
requestMethod:TWRequestMethodPOST];
just prepend the d and your recipient's twitter name.

Related

Facebook share with default status post

In one of our app, we are supposed to give an option to share newly unlocked Achievement. Requirement also includes to post defined text if share box is empty.
The problem is, we are unable to find relevant delegate method when user clicks on POST/Send button.
Code for posting status is,
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:awardToBeShareOnFB];
content.contentTitle = #"Helloworld";
content.contentDescription = #"Helloworld";
[FBSDKShareDialog showFromViewController:[self parentViewController]
withContent:content
delegate:self];
It should post "Helloworld" as a status if posting box is empty.

iOS Tumblr Integration using oauth

Trying to understand how this all works. New to oauth and api integrations.
Not looking for a better way. Looking to understand and expand on what this is doing.
I followed this tutorial and have it working
through part 3.
I kind of understand, but having a hard time connecting the code to the Tumblr API documentation.
The tutorial leaves off with having the user's Access Token.
How do I use the Access Token to get the users info with api.tumblr.com/v2/user/info in xcode?
With this information I might be able to put together an understanding in my head.
Code example would be much appreciated!
#Ir100,
use the same acess_token and secret_key you generated via OAuth Library and just change your request url(API) because every time you have to send other parameter for API call.
_consumer = [[OAConsumer alloc] initWithKey: _consumerKey secret: _secretKey];
OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL: url consumer: _consumer token:token realm:nil signatureProvider: nil] ;
if (!request) return;
if (self.pin.length)
token.verifier = _pin;
[request setHTTPMethod: #"POST"];
if (_api)
[request setHTTPMethod: #"GET"];
NSMutableArray *params = [[NSMutableArray alloc] initWithArray:request.oa_parameters];
request.oa_parameters = params;
OADataFetcher *fetcher = [[OADataFetcher alloc] init] ;
[fetcher fetchDataWithRequest: request delegate: self didFinishSelector: success didFailSelector: fail];

getting video thumbnails from vimeo

In my app i want to display the videos uploaded by a particular user in his Vimeo account.
I have completed the OAuth steps and got the video_id's of the video's uploaded by user. I tried to download the thumbnails for videos so that they can be displayed in table view or collection view.
Vimeo has provided the api method using that i got the response like this:
NSURL *url = [[NSURL alloc] initWithString:#"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.getThumbnailUrls&video_id=72961770"];
but i pasted the user id there. i tried another approach so that the user id is loaded dynamically.
NSURL *url = [[NSURL alloc] initWithString:#"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.getThumbnailUrls"];
OAMutableURLRequest *request = [[OAMutableURLRequest alloc]initWithURL:url consumer:consumer token:token realm:nil signatureProvider:nil];
OARequestParameter *p0 = [[OARequestParameter alloc] initWithName:#"video_id" value:[array objectAtIndex:0]];
NSArray *params = [NSArray arrayWithObject:p0];
[request setParameters:params];
but i got an error saying that Msg = Method not found.
can you help me to get the id dynamically or is there a way to give the video_id as a parameter to the url. Thank you
create a string for url and paste until video_id=.
NSString *url = #"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.getThumbnailUrls&video_id=";
and after that use stringByAppendingString method to append the video_id value to it and use it.
This is also not a direct way but somehow enables you to get the video thumbnails dynamically without having to paste it

Sharing my message with share kit to twitter

i imported sharekit library in my project and i write following codes
SHKItem *item = [SHKItem text:#"sample message"];
SHKTwitter* twt = [[SHKTwitter alloc] init];
[twt setItem:item];
[twt share];
or
SHKItem *item = [SHKItem text:#"sample message"];
[SHKTwitter shareItem:item];
as you know, first authentication window appears. i want to share text when i enter my user name and password. but it redirect my redirect url and window don't close automatically

Facebook feeds on iOS app?

How can I display face book feeds related to a group on an iOS App?
Is there any JSON/JSONP call to fetch the feeds??
Any help is Appreciated.
The simplest - is just to show a web page on web view. Facebook manages itself to fit the width of your webView control.
// Load facebook data
NSString *fbUrlAddress = #"http://www.facebook.com/FLORtiles"; // here you put your own group
//Create a URL object.
NSURL *fbUrl = [NSURL URLWithString:fbUrlAddress];
NSString *webHTMLfb = [NSString stringWithContentsOfURL:fbUrl encoding:NSUTF8StringEncoding error:NULL];
//NSLog(#"webHTML of facebook: %#", webHTMLfb);
//URL Requst Object
NSURLRequest *fbRequestObj = [NSURLRequest requestWithURL:fbUrl];
//Load the request in the UIWebView.
[fbWebView loadRequest:fbRequestObj];
You might need to get familiar with Facebook's Graph Api
Go through this -> https://developers.facebook.com/docs/mobile/ios/build/

Resources