Tôi đang chia sẻ Hình ảnh, video và LivePhoto bằng cách sử dụng UIActivityViewController
trên phương tiện truyền thông xã hội khác nhau.Chia sẻ ảnh trực tiếp trên WhatsApp trong Swift 3 bằng UIActivityViewController không hoạt động
Nhưng khi tôi đang chia sẻ LivePhoto trên WhatsApp, một cái gì đó như dưới đây đang xảy ra:
- khi ActivityViewController hiện -> click vào WhatsApp -> nó hiện danh sách liên lạc cho thứ hai và nhanh chóng sa thải và khi tôi cố gắng để in lỗi sử dụng bộ xử lý hoàn
ActivityViewController
nó in cái gì như thế này:
[core] SLComposeViewController remoteViewController: didTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted} [core] SLComposeViewController completeWithResult: 0 [core] SLComposeViewController skipping explicit dismiss because isBeingDismissed is already 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)
}
})
bất kỳ ai cũng có thể giúp tôi.
Cảm ơn bạn.
Âm thanh như Whats Ứng dụng không hỗ trợ ảnh trực tiếp. Bạn có thể chia sẻ nó ở một nơi khác, như iMessage không? Nếu nó hoạt động ở mọi nơi khác, đó có thể là WhatsApp không hỗ trợ nó. – EmilioPelaez
bạn có thể hiển thị mã đã thử của bạn –
@EmilioPelaez, Nếu Whatsapp không hỗ trợ ảnh trực tiếp thì khi tôi chia sẻ ảnh từ ảnh trực tiếp, nó sẽ hiển thị các lỗi ngẫu nhiên đôi khi như trên và đôi khi như "Không thể chia sẻ mục này" " –