[英]Different data size received from asset image in foreground and background in iOS 9.1?
I want to take backup of images on cloud so I calculate MD5 of an image in iOS.The issue is Md5 differs when it is calculated in foreground and background of the app. 我想备份云上的图像,所以我计算了iOS中图像的MD5。问题是,在应用程序的前景和背景中计算Md5时不同。 This issue come only in iOS 9.1.
仅在iOS 9.1中出现此问题。 I use asset library to fetch the images.
我使用资产库来获取图像。 Below function is used to get the data (Both data are different from each when the application is in foreground and in background)
下面的函数用于获取数据(当应用程序在前台和后台时,这两种数据都不同)
ALAssetRepresentation *assetRep = [asset defaultRepresentation];
CGImageRef imgRef = [assetRep fullScreenImage];
UIImage *img = [UIImage imageWithCGImage:imgRef
scale:1.0f
orientation:(UIImageOrientation)assetRep.orientation];
NSData *data = UIImageJPEGRepresentation(img, 90);
Thanks in advance.... 提前致谢....
Have a look at ALAssetRepresentation-MD5 which calculates the md5 hash from an ALAssetRepresentation
without creating a UIImage
or using UIImageJPEGRepresentation
. 看一下ALAssetRepresentation-MD5 ,它无需创建
UIImage
或使用UIImageJPEGRepresentation
即可从ALAssetRepresentation
计算md5哈希值。 I assume that one of these UIKit
-related steps is responsible for your issue, event though they should be thread-safe. 我假设与
UIKit
相关的步骤之一是造成您的问题的原因,尽管它们应该是线程安全的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.