gpt4 book ai didi

swift3 - xcode 8 PHPhotoLibrary.requestAuthorization 导致崩溃

转载 作者:行者123 更新时间:2023-12-03 14:52:14 27 4
gpt4 key购买 nike

每次我尝试为照片库请求授权时,我的应用程序在模拟器中运行时总是崩溃。我在 didFinishLaunchingWithOptions 的 appDelegate 中使用以下代码:

if PHPhotoLibrary.authorizationStatus() != PHAuthorizationStatus.authorized {
PHPhotoLibrary.requestAuthorization({ (status: PHAuthorizationStatus) in

})
}

在 swift 3.0 中使用 xcode 8 beta。

最佳答案

在我的测试中,除非您在实际设备上运行,否则 iOS 10 不喜欢输出有用的错误消息。在这种特殊情况下,您可能没有提供 key NSPhotoLibraryUsageDescription在您的 Info.plist 文件中,并且必须在请求授权之前提供该值。

关于swift3 - xcode 8 PHPhotoLibrary.requestAuthorization 导致崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37879506/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com