【发布时间】:2017-12-18 04:40:56
【问题描述】:
我正在使用UIActivityViewController 在不同的社交媒体上分享图像、视频和 LivePhoto。
但是当我在 WhatsApp 上分享 LivePhoto 时,会发生以下情况:
- 当 ActivityViewController 存在时 -> 单击 WhatsApp -> 它会显示第二个联系人列表并快速关闭,当我尝试使用
ActivityViewController完成处理程序打印错误时,它会打印如下内容:
[核心] SLComposeViewController 远程视图控制器: 没有终止错误: 错误域=_UIViewServiceInterfaceErrorDomain 代码=3“(空)” UserInfo={Message=服务连接中断} [核心] SLComposeViewController completeWithResult: 0 [核心] SLComposeViewController 跳过显式关闭,因为 isBeingDismissed 已经是 1 SLComposeViewController dealloc
I have tried with this code :
PHImageManager.default().requestImageData(for: selectedAsset, options: nil, resultHandler: { (imgData, str, image, info) in
activityItems.append(imgData!)
let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash
activityViewController.completionWithItemsHandler = {(activityType: UIActivityType?, completed: Bool, returnedItems:[Any]?, error: Error?) in
//Do whatever you want
print("activityType ----- \(activityType) || error ----- \(error)")
}
// present the view controller
DispatchQueue.main.async {
// self.present(activityViewController, animated: true, completion: nil)
self.navigationController?.present(activityViewController, animated: true, completion: nil)
}
})
谁能帮帮我。
谢谢。
【问题讨论】:
-
听起来 WhatsApp 不支持实时照片。你可以在其他地方分享它,比如 iMessage 吗?如果它在其他任何地方都有效,那可能是 WhatsApp 不支持它。
-
你能展示你尝试过的代码吗
-
@EmilioPelaez,如果 Whatsapp 不支持实时照片,那么当我从实时照片分享静止图像时,它有时会显示随机错误,有时像上面那样,有时像“此项目无法共享,请选择不同的项目"
-
@Anbu.Karthik : 我在上面添加了代码
-
图片数据为nsdata否则
标签: ios objective-c swift3 uiactivityviewcontroller apple-live-photos