Avoid force casting items to URL (#2696)
This commit is contained in:
parent
0ff59554fa
commit
dd66405343
1 changed files with 18 additions and 12 deletions
|
|
@ -175,10 +175,12 @@ class ShareViewController: SLComposeServiceViewController {
|
|||
dispatchGroup.enter()
|
||||
itemProvider.loadItem(forTypeIdentifier: kUTTypeMovie as String, options: nil, completionHandler: ({item, error in
|
||||
if error == nil {
|
||||
let attachment = self.saveAttachment(url: item as! URL)
|
||||
if (attachment != nil) {
|
||||
attachment?.type = kUTTypeMovie as String
|
||||
self.attachments.append(attachment!)
|
||||
if let url = item as? URL {
|
||||
let attachment = self.saveAttachment(url: url)
|
||||
if (attachment != nil) {
|
||||
attachment?.type = kUTTypeMovie as String
|
||||
self.attachments.append(attachment!)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.dispatchGroup.leave()
|
||||
|
|
@ -187,10 +189,12 @@ class ShareViewController: SLComposeServiceViewController {
|
|||
dispatchGroup.enter()
|
||||
itemProvider.loadItem(forTypeIdentifier: kUTTypeImage as String, options: nil, completionHandler: ({item, error in
|
||||
if error == nil {
|
||||
let attachment = self.saveAttachment(url: item as! URL)
|
||||
if (attachment != nil) {
|
||||
attachment?.type = kUTTypeImage as String
|
||||
self.attachments.append(attachment!)
|
||||
if let url = item as? URL {
|
||||
let attachment = self.saveAttachment(url: url)
|
||||
if (attachment != nil) {
|
||||
attachment?.type = kUTTypeImage as String
|
||||
self.attachments.append(attachment!)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.dispatchGroup.leave()
|
||||
|
|
@ -199,10 +203,12 @@ class ShareViewController: SLComposeServiceViewController {
|
|||
dispatchGroup.enter()
|
||||
itemProvider.loadItem(forTypeIdentifier: kUTTypeFileURL as String, options: nil, completionHandler: ({item, error in
|
||||
if error == nil {
|
||||
let attachment = self.saveAttachment(url: item as! URL)
|
||||
if (attachment != nil) {
|
||||
attachment?.type = kUTTypeFileURL as String
|
||||
self.attachments.append(attachment!)
|
||||
if let url = item as? URL {
|
||||
let attachment = self.saveAttachment(url: url)
|
||||
if (attachment != nil) {
|
||||
attachment?.type = kUTTypeFileURL as String
|
||||
self.attachments.append(attachment!)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.dispatchGroup.leave()
|
||||
|
|
|
|||
Loading…
Reference in a new issue