Created
April 30, 2013 08:55
-
-
Save kenshin03/5487495 to your computer and use it in GitHub Desktop.
Facebook Graph API request with ACAccountStore refer to https://gist.github.com/kenshin03/5487487 for the initAccount part
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) likeFeed:(NSString*)graphID { | |
InitAccountSuccessBlock successBlock = ^{ | |
NSString * likeURLString = [NSString stringWithFormat:@"https://graph.facebook.com/%@/likes", graphID]; | |
NSURL * feedURL = [NSURL URLWithString:likeURLString]; | |
SLRequest * request = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodPOST URL:feedURL parameters:nil]; | |
NSLog(@"request.URL: %@", request.URL); | |
request.account = self.facebookAccount; | |
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { | |
NSString * responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; | |
NSLog(@"responseString: %@", responseString); | |
}]; | |
}; | |
if (self.facebookAccount == nil){ | |
[self initAccount:successBlock]; | |
}else{ | |
successBlock(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment