iOS FBSDKProfilePictureView返回空白图像

iOS FBSDKProfilePictureView返回空白图像,ios,facebook,object,facebook-ios-sdk,Ios,Facebook,Object,Facebook Ios Sdk,因此,我试图创建一个简单的滚动条,其中包含用户喜欢的页面,并显示图像和名称。但是,纵断面图显示的是空白图像,而不是占位符图片,这意味着它正在接收要显示的图像。在实际的FBSDKProfilePictureView代码中放置一些断点后,特别是在\u updateImageWithData:state:,它显示每个图像的数据对象只有97个字节。有趣的是,当我创建一个独立的个人资料图片视图时 FBSDKProfilePictureView *profilePictureView = [[FBS

因此,我试图创建一个简单的滚动条,其中包含用户喜欢的页面,并显示图像和名称。但是,纵断面图显示的是空白图像,而不是占位符图片,这意味着它正在接收要显示的图像。在实际的FBSDKProfilePictureView代码中放置一些断点后,特别是在
\u updateImageWithData:state:
,它显示每个图像的数据对象只有97个字节。有趣的是,当我创建一个独立的个人资料图片视图时

    FBSDKProfilePictureView *profilePictureView = [[FBSDKProfilePictureView alloc] initWithFrame:CGRectMake(inset, inset, profileSize, profileSize)];
    profilePictureView.profileID = @"4"; //Mark Zuckerberg's id
它正确地显示图像

因此,起初我认为这可能与设置太多的配置文件ID有关,从而创建了太多的url请求,但如果我只运行下面的代码一次(即没有循环),它仍然返回相同的97字节

下面是我用来生成滚动视图的代码

    for (int i = 0; i < numToIterate; i++) {
        NSDictionary *curr = [sharedInterests objectAtIndex:i];
        NSString *idNumber = [curr objectForKey:@"id"];
        NSString *name = [curr objectForKey:@"name"];
        NSLog(@"getting %@, %@.", name, idNumber);
        // get logo
        FBSDKProfilePictureView *itemView = [[FBSDKProfilePictureView alloc] initWithFrame:CGRectMake(i * (smallFrameWidth + horizontalBufferBetweenPics) + horizontalBufferBetweenPics, 0, smallFrameWidth,smallFrameHeight)];
        [self.scrollView addSubview:itemView];
        [itemView setProfileID:idNumber];
        // create description
        UILabel *currDescriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(i * (smallFrameWidth + horizontalBufferBetweenPics) + horizontalBufferBetweenPics, smallFrameHeight, categoryLabelWidth, categoryLabelHeight)];
        currDescriptionLabel.text = name;
        currDescriptionLabel.backgroundColor = [[UIColor blueColor] colorWithAlphaComponent:0.5];
        currDescriptionLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:12];
        currDescriptionLabel.textAlignment = NSTextAlignmentCenter;
        currDescriptionLabel.numberOfLines = 2;
        [scrollView addSubview:currDescriptionLabel];
    }
for(int i=0;i
我创建了一个FBProfilePictureView,提供错误报告。它允许您设置报告错误的完成处理程序:

self.facebookPictureView.completionHandler = ^(DBFBProfilePictureView* view, NSError* error){
    if(error) {
        view.showEmptyImage = YES;
        view.profileID = nil;
        NSLog(@"Loading profile picture failed with error: %@", error);
    } 
}

这工作做得很好!然而,我仍然不知道错误的来源。您是手动下载图像还是仍然使用与FBProfilePictureView相同的方法?它以相同的方式下载,但如果您对同一配置文件id有多个请求,则会从内存缓存中返回图像。也许这就是区别?我没有任何要求相同id的请求。。。奇怪。此外,图像的分辨率似乎较低,您认为这是因为您下载了一个较低分辨率的图像,还是因为我正在抓取多个图像?请参阅
-(NSDictionary*)imageQueryParam以了解请求的大小是如何基于视图的大小的。很抱歉,时间太长了。原来你从来没有在refreshImage:中使用过参数,我只是在url的末尾添加了“?fields=url,width,height&height=%d&width=%d”,结果一切正常。我只使用方形图片,所以这对我来说很有用。如果需要非方形图像,可以进行一些简单的更改。