我的代码在 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" wants to use "facebook.com" to Sign in
。
我提到的链接:PhotoPicker 发现错误:错误域=PlugInKit 代码=13 https://stackoverflow.com/questions/44465904/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
}
})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)