According to the documentation https://www.whatsapp.com/faq/en/iphone/23559013, setting file format to .wai and UTI to net.whatsapp.image will only show Whatsapp in application list,
But its showing other application like Add to notes,messenger also along with whatsapp option.
if let imageData = UIImageJPEGRepresentation(image, 1.0)
{
let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
let documentsDir: AnyObject = path[0]
let imagePath = documentsDir.stringByAppendingPathComponent("Main")
NSFileManager.defaultManager().createDirectoryAtPath(imagePath, withIntermediateDirectories: true, attributes: nil)
let tempFile = NSURL(fileURLWithPath: imagePath+"/image.wai")
do
{
try imageData.writeToURL(tempFile, options: .DataWritingAtomic)
self.documentController = UIDocumentInteractionController(URL: tempFile)
self.documentController.UTI = "net.whatsapp.image"
self.documentController.presentOpenInMenuFromRect(self.view.frame, inView: self.view, animated: true)
}
catch
{
// alert
}
}
Please suggest if i am doing something wrong here