ios UIImageWriteToSavedPhotosAlbum报错 NSPhotoLibraryAddUsageDescription

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #000000; background-color: #ffffff }
span.s1 { color: #ba2da2 }
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 }
span.s1 { }

最近学习IOS相关知识. 视频课程[UIImage](https://www.imooc.com/video/12718)

相关知识点: 存储一张本地图片到系统相册中.

API: UIImageWriteToSavedPhotosAlbum

按照视频教程Dome中书写代码, 启动报错如下:

[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app‘s Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.

按照如上所述. 需要向info.plist中添加相关描述文字.

打开 Info.plist, 添加对应配置NSPhotoLibraryAddUsageDescription, type默认string, value填写: 界面提示文字.

效果如下:

模拟器 8p / 11.4

另:

参考链接:  http://www.cnblogs.com/KiVen2015/p/6627253.html

原文地址:https://www.cnblogs.com/dfyg-xiaoxiao/p/9576370.html

时间: 2024-11-17 22:20:26

ios UIImageWriteToSavedPhotosAlbum报错 NSPhotoLibraryAddUsageDescription的相关文章

[iOS Xcode8报错]dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserN

[iOS Xcode8报错]dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserN 升级了Xcode8,但是我的真机是iOS7系统,在我解决了Xcode8不支持iOS7系统以后(http://blog.csdn.net/iOSTianNan/article/details/52619319),真机调试出现如下报错 dyld: Library not loaded: /System

iOS运行报错:[AppName] was compiled with optimization....

刚升级了Xcode7之后,使用iOS9 SDK,启动app的时候一直报此错 [AppName] was compiled with optimization - stepping may behave oddly; variables may not be available. 手机上调试一启动就会出现上面那个错误,一启动就报错,然后就会闪退.([AppName]那里是我的应用的名字.) 解决方法: 把Architecture中的PlatForm指明为"IOS",而不是默认的"

iOS中 报错:mutating method sent to immutable object

今天我在切换账号登录,获取用户信息时,程序崩溃,报错:mutating method sent to immutable object 当我设置全局断点进行调试时,这个就是给我们所报错的方法,并打印报错信息 这是我们所调用的方法的地方,此时self.msgDict是不可变的字典,将它改为可变字典即可. 另外:mutating method sent to immutable object的意思就是说:要可变对象调用的方法,使用不可变对象调用

IOS编译报错:objc-class-ref in AppDelegate.o之解决方案

xcode6.0升级到xcode6.1后,程序编译报错,错误如下:这是个很常见的错误,很多项目在更换xcode版本后,都会出现类似的问题. Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_QQApiInterface", referenced from: objc-class-ref in AppDelegate.o "_OBJC_CLASS_$_ShareSDK", referenced from

iOS CFNetwork报错

2016-11-16 10:05:35.082 天天送[46197:11758717] 46197: CFNetwork internal error (0xc01a:/BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork_Sim/CFNetwork-808.1.4/Loading/URLConnectionLoader.cpp:304) 这个问题应该是HTTPS限制引起的(直接使用NSURLSession都会报) 解决办法: 上面的这

IOS运行报错 "dyld: Library not loaded" 原因分析

我们的游戏IOS版在接入易接SDK后,启动出现如下错误 dyld: Library not loaded: @rpath/OnlineAHelper.framework/OnlineAHelper Referenced from: /var/mobile/Containers/Bundle/Application/35ED2A71-7F60-4A16-BA4C-ECD6493A1EE1/yzg.app/yzg Reason: no suitable image found. Did find:

iOS keychain报错 25293

经过查找发现25293对应的错误是如下,即用户名和密码不正确. errSecAuthFailed                         = -25293,    /* The user name or passphrase you entered is not correct. */ 后来才发现原来是因为测试机没有设置touchId所致,设置好touchId之后完美生成密钥对.

iOS之报错“Cannot create __weak reference in file using manual reference counting”解决办法

解决的办法:在Build Settings--------->Aplle LLVM8.0 - Language - Objectibe-C------------->Weak Reference In Manual Retain Release 设置为YES.

iOS 程序报错:reason: [NSArrayI addObject:]: unrecognized selector sent to instance

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI addObject:]: unrecognized selector sent to instance 0x4b17be0' 错误:NSArray 不能使用 addObject:方法.可能是在程序运行的过程中,NSMutableArray转为了NSArray. 解决方案:核查数组,看看是否在NSArra