2016-08-06 47 views
0

当您使用脸谱图API从脸书检索图片时,是否有人知道它以什么格式出现?它是一个PNG或JPEG文件?我想将图像转换为NSData并将其存储在我的数据库中。我只要求,因为在迅速两个命令将图像转换为NSData的,即你可以使用:Facebook图像格式?

UIImagePNGRepresentation

UIImageJPEGRepresentation

F.Y.I. ?

+0

你可以从'NSData'本身或从HTTP响应中找到图像的类型。 [更多这里](http://www.astro.keele.ac.uk/oldusers/rno/Computing/File_magic.html) – Khundragpan

回答

0
You can use this code to display your facebook profile picture in imageview: 

ivUserProfilePic =图像配的UIImage(数据:profileData)

我们可以使用UIImagePNGRepresentation和UIImageJPEGRepresentation两者。

+0

我不想显示图像,我想将图像存储为NSData – Jobs