WhatsApp IOS Share Extension: обмен несколькими изображениями приводит к дубликатам (одно и то же изображение повторяетсIOS

Программируем под IOS
Anonymous
WhatsApp IOS Share Extension: обмен несколькими изображениями приводит к дубликатам (одно и то же изображение повторяетс

Сообщение Anonymous »

when try to share 5 different images from whatsapp to our app it will showing last image 5 times but except whatsapp means from gallery or from our app to our app then 5 different images showing fine in ios app we are try this logic

DispatchQueue.global(qos: .userInteractive).async { [weak self] in
guard let self = self else { return }
guard let inputItem = self.extensionContext? NsextensionItem else {return}
Guard Var Attachments = inputitem.attachments else {return} < /p>

Код: Выделить всё

// Remove unwanted MapKit item types
attachments.removeAll {
$0.hasItemConformingToTypeIdentifier("com.apple.mapkit.map-item")
}

let maxCount = attachments.count
debugPrint("handleShareObject:: Shared contents:", attachments)

for attachment in attachments {
if attachment.hasItemConformingToTypeIdentifier(self.imageContentType) {
self.handleShareObject(attachment: attachment, type: .image, maxCount: maxCount)
} else if attachment.hasItemConformingToTypeIdentifier(self.textContentType) {
self.handleShareObject(attachment: attachment, type: .text, maxCount: maxCount)
} else if attachment.hasItemConformingToTypeIdentifier(self.videoContentType) {
self.handleShareObject(attachment: attachment, type: .video, maxCount: maxCount)
} else if attachment.hasItemConformingToTypeIdentifier(self.fileAudioType) {
self.handleShareObject(attachment: attachment, type: .audio, maxCount: maxCount)
} else if attachment.hasItemConformingToTypeIdentifier(self.fileURLType) {
self.handleShareObject(attachment: attachment, type: .file, maxCount: maxCount)
} else if attachment.hasItemConformingToTypeIdentifier(self.urlContentType) {
self.handleShareObject(attachment: attachment, type: .url, maxCount: maxCount)
}
}
}

Подробнее здесь: https://stackoverflow.com/questions/796 ... icates-sam

Вернуться в «IOS»