问题
I have shared an image on Whatsapp from an iOS app using UIDocumentInteractionController. But, right now, I need to share an image without using UIDocumentInteractionController. Is it possible?
回答1:
It's not possible, since all apps are sandboxed the UIDocumentInteractionController
is the only way to share files among apps.
Read the FAQ on integrate WhatsApp it only mentions UIDocumentInteractionController
for sharing files (images, video and audio). You can if you only want WhatsApp to show up change the extension to of the file to:
- images - .wai which is of type net.whatsapp.image
- videos - .wam which is of type net.whatsapp.movie
- audio files - .waa which is of type net.whatsapp.audio
回答2:
I don't see why you would not want to use the UIDocumentInteractionController. Maybe a temporary fix like this can help:
if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]])
{
}
来源:https://stackoverflow.com/questions/23295623/share-image-on-whatsapp-from-an-ios-app-without-using-uidocumentinteractioncontr