Finally, I got an answer. this may be useful for you, so I am posting this answer.
use this macro#define FACEBOOK_GRAPH @"https://graph.facebook.com/v2.3/oauth/access_token?client_id=USE_YOUR_CLIENT_ID&client_secret=USE_YOUR_CLIENT_SECRET&grant_type=client_credentials"NOTE. you can get "client_id" and "client_secret" by registering your application on developer.facebook.com, now call
FACEBOOK_GRAPH as below.
AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager]; //manager.responseSerializer = [AFHTTPResponseSerializer serializer]; manager.responseSerializer=[AFJSONResponseSerializer new]; AFHTTPRequestOperation* operation = [manager POST:FACEBOOK_GRAPH parameters:nil success:^(AFHTTPRequestOperation* op, id responseObject){ //here pass your URL as a string and access Token as a string, access token will found in responseObject } failure:^(AFHTTPRequestOperation* op, NSError* error){ NSLog(@"\n\nerror--->%@\n\n",error.localizedDescription); }]; [operation start];
now the second way to get the image from our URL, use our URL and access the token obtained above,
url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; token = [token stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer=[AFJSONResponseSerializer new]; AFHTTPRequestOperation* operation = [manager POST:[NSString stringWithFormat:@"https://graph.facebook.com/v2.3/?id=%@&access_token=%@&scrape=true",url,token] parameters:nil success:^(AFHTTPRequestOperation* op, id responseObject){ NSLog(@"\n\nData Response==\n%@\n",responseObject);
Vats
source share