从Facebook这样的任何URL获取特定图像

Vat*_*kla 7 xcode objective-c nsurl ios

我的问题看起来可能与其他问题类似,但事实并非如此.(据我所知).我无法理解如何从任何URL获取特定图像像Facebook一样,我无法向您显示屏幕截图,因为我没有真正的设备.但我可以告诉你Skype的屏幕截图来自MAC.任何帮助将不胜感激.谢谢.在此输入图像描述
编辑:
我使用此链接获得了favicon,但它非常小我想要更大的尺寸.

Vat*_*kla 6

最后,我得到了答案.这可能对你有帮助,这就是为什么我发布这个答案.
使用此宏
#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"
注意:您可以通过在developer.facebook.com上注册您的应用程序来获取"client_id"和"client_secret",
现在打电话给FACEBOOK_GRAPHLike bellow.

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];
Run Code Online (Sandbox Code Playgroud)

现在是从我们的URL获取图像的第二种方法,使用我们的URL并从上面的方法访问Token

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);
        //you will get Image URL in response
    }failure:^(AFHTTPRequestOperation* op, NSError* error){
                                                NSLog(@"##error--->\n%@",error.localizedDescription);
                                         }];
    [operation start];
Run Code Online (Sandbox Code Playgroud)