imageWithData 转成的image 再次转换成data 无论用什么方法都不行,例如UIImagePNGRepresentation
原因:先看一下苹果官方的表示
This function returns the thumbnail as a CFData object containing image data. The document’s application must save this data as part of the document’s data; the generator retrieves it and uses this function to return it to the client. Before you call this function, call QLThumbnailRequestGetMaximumSize(_:) to obtain the maximum allowed size for the thumbnail and resize the image if necessary.
看完这一段 想必明白了imageWithData 其实转的是缩略图
接着看UIImagePNGRepresentation的官方描述
A data object containing the PNG data, or nil if there was a problem generating the data. This function may return nil if the image has no data or if the underlying CGImageRef contains data in an unsupported bitmap format.
就是说如果没有PNG数据,这个函数可以返回nil
但是上面说了返回的是缩略图 那么原有的PNG数据就会被破坏
因此再次转换的时候回变成nil