Not able to share the video on twitter through UIActivityViewController.
Text and local video storage works fine. So authentication is not an issue.
If video is stored in the app itself, then the share works fine
Path URL
file:///private/var/containers/Bundle/Application/B7855569-3254-4CC2-9573-254D09528E38/podhunt.app/PlugIns/podhunt-shareExtension.appex/demo_video.mp4
If the path is below, then the twitter share does not work
Path Url
file:///var/mobile/Containers/Data/PluginKitPlugin/5831780C-50AF-41FA-8435-941CAC47EBE6/Documents/10c41d4a-c161-4c78-bc61-ca789804a982.mp4
This does not work
URLSession.shared.downloadTask(with: audioUrl) { location, response, error in
guard let location = location, error == nil else { return }
do {
try FileManager.default.moveItem(at: location, to: destinationUrl)
DispatchQueue.main.async {
let activityVC = UIActivityViewController(activityItems: [destinationUrl], applicationActivities: nil)
self.present(activityVC, animated: true, completion: nil)
}
} catch {
}
}.resume()
This works
URLSession.shared.downloadTask(with: audioUrl) { location, response, error in
guard let location = location, error == nil else { return }
do {
try FileManager.default.moveItem(at: location, to: destinationUrl)
DispatchQueue.main.async {
guard let path = Bundle.main.path(forResource: "demo_video", ofType:"mp4") else {
return
}
let activityVC = UIActivityViewController(activityItems: [URL(fileURLWithPath: path)],applicationActivities: nil)
self.present(activityVC, animated: true, completion: nil)
}
} catch {
}
}.resume()
I am working on iOS app extension.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…