我的代码在iOS 10上工作正常,但在更新到iOS 11之后似乎没有任何效果.
这是我在Facebook上分享视频的代码:
internal func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]){
self.dismiss(animated: true, completion: { () -> Void in
})
guard let videoURL = info[UIImagePickerControllerReferenceURL] as? NSURL else {
return // No video selected.
}
print(videoURL)
let video = Video(url: videoURL as URL)
var content = VideoShareContent(video: video)
content.hashtag = Hashtag.init("#Ojas")
if FBSDKAccessToken.current() != nil{
if FBSDKAccessToken.current().hasGranted("publish_actions") {
print("Have permission")
let sharer = GraphSharer(content: content)
sharer.failsOnInvalidData = true
sharer.message = "From #Ojas App"
sharer.completion = { result in
// Handle share results
print("Share results : \(result)")
}
do{
try sharer.share()
//try shareDialog.show()
}catch{
print("Facebook share error")
}
}
}
但是之前的工作没有任何效果.
这是我在ImagePicker中看到的日志:
[discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}
现在有一个警告说“app_name”想用“facebook.com”登录.
我提到的链接:
PhotoPicker discovery error: Error Domain=PlugInKit Code=13
知道为什么一切都停止在iOS 11工作.任何帮助将不胜感激.
最佳答案 好的,这是关于询问我在应用程序开始时已经问过的权限.我还需要再问一次,我不知道为什么,但它确实有效.
PHPhotoLibrary.requestAuthorization({ (status: PHAuthorizationStatus) -> Void in
()
if PHPhotoLibrary.authorizationStatus() == PHAuthorizationStatus.authorized {
print("creating 2")
// Impelement UiImagepicker method
}
})