IOS swift creating app folder error

后端 未结 2 801
星月不相逢
星月不相逢 2021-01-16 06:01

I got problem with creating folder for PhotoLibrary. Does anyone know what is wrong there?

            var albumPlaceholder:PHObjectPlaceholder         


        
2条回答
  •  萌比男神i
    2021-01-16 07:01

    You don't have permission to access Photo Library. You need to request it first. So use the following code for that:

    PHPhotoLibrary.requestAuthorization
    { (PHAuthorizationStatus status) -> Void in
         switch (status)
         {
            case .Authorized:
                // Permission Granted
                println("Write your code here")
            case .Denied:
                // Permission Denied
                println("User denied")
            default:
                println("Restricted")
            }
        }
    

    For more info refer : requestAuthorization

提交回复
热议问题