本文介绍了是否有ALAssetsLibrary的样本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于iPhone 4,很多API都不能再使用了。
For iPhone 4 , a lot API can not be used any more.
我正在为UIImageWriteToSavedPhotosAlbum寻找替代解决方案。
I am looking for alternative solution for UIImageWriteToSavedPhotosAlbum.
ALAssetsLibrary是Apple在新iOS 4中的最新解决方案。
ALAssetsLibrary is current solution from Apple in new iOS 4.
任何人都有这方面的经验,可以给一些样本或开源项目?
Anyone has experience for that and can give some samples, or open source projects ?
谢谢
推荐答案
你需要做这样的事情 -
you need to do something like this -
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
}] ;
虽然我想弄清楚如何保持此代码与iphone 3 SDK兼容,但我会疯狂。
Although I'm going crazy trying to figure out how to keep this code compatible with iphone 3 SDK.
这篇关于是否有ALAssetsLibrary的样本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!