Share image on Whatsapp from an iOS app without using UIDocumentInteractionController

烈酒焚心 提交于 2019-12-10 00:16:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!