【问题标题】:Request photolibrary permission on ios causing watchos to crash?在 ios 上请求照片库权限导致 watchos 崩溃?
【发布时间】:2017-01-31 18:47:10
【问题描述】:

操作系统:IOS 10 和 watchos3

我在开发最新应用时发现了一个问题。

我的应用需要请求照片库权限才能保存一些图像。 在手表应用和ios中,我在plist中添加了照片库访问权限

我注意到,当手表应用在前台运行时,我在我的 ios 设备上按请求权限。

隐私 - 照片库使用说明

一旦ios权限请求成功,手表应用会崩溃,代码如下程序以exit code结束:0,这似乎是操作系统级别的行为我。

    
    func requestPhotoLibraryPermission(){
        PHPhotoLibrary.requestAuthorization { status in
            switch status {
            case .authorized:
                
                break
            default:
                self.showErrorMessage(title: NSLocalizedString("Permission Denied", comment: "Permission Denied"), message:  NSLocalizedString("You can enable Photo Library permission from the settings app", comment: "You can enable Photo Library permission from the settings app") ,completionBlock: {
                })
                // place for .NotDetermined - in this callback status is already determined so should never get here
                break
            }
            
        }
        
    }

如您所见,代码非常简单。有人遇到过类似的问题吗?有什么已知的解决方法吗?

【问题讨论】:

  • 与麦克风权限相同的问题。
  • Apple Music 存在同样问题

标签: ios debugging crash ios10 watchos-3


【解决方案1】:

如果我误解了,请原谅我,但是您是否将键:“隐私 - 照片库使用说明”和键值的使用说明添加到您的 plist?

【讨论】:

    【解决方案2】:

    测试了一个全新的项目,同样的问题,我相信 iOS 会在权限更改时通知 watchos 重新启动应用程序。

    在 iOS 设置页面更改应用权限并返回应用时的行为相同。

    【讨论】:

      猜你喜欢
      • 2016-12-03
      • 1970-01-01
      • 2012-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多