简体   繁体   中英

Error retrieving profile picture from facebook swift FBSDK

This is the code I use to retrieve picture in my code. I call this function immediately after I send the graphRequest.

let upLoadData = try Data(contentsOf: URL(fileURLWithPath: "https:/graph.facebook.com/(fbUID)/picture?type=large")) let upLoadImage = UIImage(data: upLoadData)?.jpeg(.low)

However, this is the error I get

Error Domain=NSCocoaErrorDomain Code=260 "The file “picture?type=large” couldn't be opened because there is no such file." UserInfo={NSFilePath=/https:/graph.facebook.com/(my facebook user id)/picture?type=large, NSUnderlyingError=0x604001451df0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

I checked to see if I can access this url and when I type in the url I successfully download the image. Is there any step that I am missing?

结果是由于我使用了URL(fileURLWithPath:,而不是URL(string:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM