对于iPhone 4,很多API都不能再使用了.
我正在为UIImageWriteToSavedPhotosAlbum寻找替代解决方案.
ALAssetsLibrary是Apple在新iOS 4中的最新解决方案.
任何人都有这方面的经验,可以提供一些样品,或开源项目?
谢谢
小智 5
你需要做这样的事情 -
ALAssetsLibrary* library=[[ALAssetsLibrary alloc] init] ;
// Request to save the image to camera roll
[library writeImageToSavedPhotosAlbum:img.CGImage orientation:(ALAssetOrientation)img.imageOrientation
completionBlock:^(NSURL* assetURL, NSError* error) {
if (error != NULL)
// Show error message...
else // No errors
// Show message image successfully saved
}] ;
Run Code Online (Sandbox Code Playgroud)
虽然我疯狂地想弄清楚如何保持这个代码与iphone 3 SDK兼容.