gpt4 book ai didi

ios - 如何使用 Facebook SDK 保存从 fbprofilepictureview 获取的用户图像

转载 作者:行者123 更新时间:2023-11-29 02:44:01 24 4
gpt4 key购买 nike

所以我正在我目前正在开发的 iOS 应用程序中实现 Facebook 登录按钮,我试图保存使用此行访问的用户的个人资料图片;

self.profilePicture.profileID = user.id;

我没有运气存储该图像以在应用程序的其他地方使用。我尝试了很多方法,包括这种方法

imageUrl=[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?redirect=true", user.username];

欢迎任何帮助!

最佳答案

您需要使用user.objectID,而不是user.username

您还可以使用我的 FBProfilePictureView 的直接替代品 DBFBProfilePictureView 。这将 imageView 公开为只读属性。使用它,你的代码将是这样的......

self.profilePicture.completionHandler = ^(DBFBProfilePictureView* view, NSError* error){
if(error) {
view.showEmptyImage = YES;
NSLog(@"Loading profile picture failed with error: %@", error);
} else {
UIImage *image = view.imageView.image;
NSData *imageData = UIImagePNGRepresentation(image);
[imageData writeToFile:filename atomically:NO];
}
};

关于ios - 如何使用 Facebook SDK 保存从 fbprofilepictureview 获取的用户图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25363330/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com