2016-08-06 52 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