您當前位置>首頁 » 新聞資訊 » 技(jì)術(shù)分(fēn)享 >
UIImageWriteToSavedPhotosAlbumcrash
發表時(shí)間(jiān):2021-1-10
發布人(rén):葵宇科(kē)技(jì)
浏覽次數(shù):55
有(yǒu)時(shí)使用(yòng) UIImageWriteToSavedPhotosA'≠lbum 保存圖片到(dào)相(xiàng)冊會(h©≠φuì)crash 出現(xiàn) exc_bad♦↓♣£_access的(de)錯(cuò)誤。可(kě)以嘗試下(xià)先• 将image轉為(wèi)png,再存儲。
代碼如(rú)下(xià):
UIImage* image = myImage;// myImage為(wèi)自(zì)己的(∞∏∞de)圖片 NSData* imageData = UIImageΩ♠PNGRepresentation(myImage); UIImage* newImag☆ ∞★e = [UIImage imageWithData:imageData]; UI'♦ImageWriteToSavedPhotosAlbum(ne<≥πwImage, nil, nil, nil);