ios - 将 uiimage 保存到 ios 扩展中的照片库

标签 ios objective-c ios8 uiimage

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum:[image CGImage] orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){
    if (error) {
    // TODO: error handling
    } else {
    // TODO: success handling
    }
}];

我使用上面的代码将uiimage保存到我的自定义键盘扩展中的照片库中。但我遇到了访问被拒绝的错误。我尝试允许此扩展程序访问照片库,但在设置->隐私->照片中看不到此扩展程序。请帮我!谢谢。

最佳答案

请阅读Understanding privacy and Location Services on iPhone, iPad, and iPod touch with iOS 8 document .

苹果说,

You can turn Location Services on or off at Settings > Privacy > Location Services. You can turn Location Services on either during the Setup Assistant process or later through the Location Services setting. You can individually control which apps and system services have access to Location Services data. When Location Services are off, apps can't use your location in the foreground or background. This will limit the performance of various Apple and third-party apps.

关于ios - 将 uiimage 保存到 ios 扩展中的照片库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28008295/

相关文章:

ios - 使用以图像为源文件的 AVfoundation 进行人脸识别

objective-c - 分配和初始化一个小的 UIImage 有多昂贵

ios - 在 AutoLayout - iOS 中,约束计数始终为零 ( 0 )

ios - 为什么不同的蓝牙音箱在 AVAudioSession (IOS) 方面会有不同的表现

objective-c - NKAssetDownload addAssetWithRequest apns sigabrt

ios - 在动画中移动时如何允许触摸 UIButton?

当设备倾斜到横向时 iOS 应用程序崩溃

ios - 激活 iOS 8 自定义键盘内的文本字段时出现延迟

facebook - 通过 UIActivityViewController 将图像共享到 Facebook/Twitter 在 iOS 8 中停止工作

ios - 旋转到横向时如何更新约束