I am trying to share UIImage with text to other applications.
All works good, but with what's app, i have some troubles.
What's app shares only text without image.
let activityViewController = UIActivityViewController(activityItems: [img, NSLocalizedString("text", comment: "")], applicationActivities: nil)
self.present(activityViewController, animated: true, completion: nil)
Related
I share an invite through UIActivityViewController by passing the text. I am able to achieve it. But I have display issue as shown in the image below. A greyed box displayed over the text at the top. Below is my code
let objectToShare = inviteReferrals.inviteData
let vc = UIActivityViewController(activityItems: [objectToShare], applicationActivities: [])
present(vc, animated: true)
Can any one help me, why this box comes and how to avoid it.
ActivityViewControllerDisplay
let activityViewController = UIActivityViewController(activityItems: [objectToShare], applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view
self.present(activityViewController, animated: true, completion: nil)
I am displaying a UIActivityViewController in my app, but the first time I do this, it takes ages to pop, like 5+ seconds. The next times I don't have this issue however.
Here is how I call it:
DispatchQueue.main.async {
let avc = UIActivityViewController(activityItems: [url], applicationActivities: nil)
avc.excludedActivityTypes = [.airDrop]
self.present(avc, animated: true, completion: nil)
}
I also tried adding this trick in AppDelegate, but with no luck:
let avc = UIActivityViewController(activityItems: ["start"], applicationActivities: nil)
avc.becomeFirstResponder()
avc.resignFirstResponder()
Thank you for your help
I'm using UIActivityViewController to present the share sheet.
can share the image and text together as expected in all apps except in WhatsApp. There only the text is being shown to send and not the image.
What am I doing wrong here?
let text = "Hey! Check this out"
let shareSheet = UIActivityViewController(activityItems: [text, UIImage(named: "Light-HomeScreen")!], applicationActivities: nil)
self.present(shareSheet, animated: true, completion: nil)
Thanks in advance
I currently have an app in the store that I am updating. The app allows a user to click a button and then share the image using the iOS Sharing Extension. Is there a way to detect which option the user has selected (ex: Facebook or Twitter) and then resize the image according to the option selected? I know how to resize my image just have no clue where to begin with the conditional.
Currently this is what I have for my button:
if let image = sender.currentImage {
let objectsToShare = [image]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
//New Excluded Activities Code
activityVC.excludedActivityTypes = [UIActivityTypeAirDrop, UIActivityTypeAddToReadingList]
//
self.presentViewController(activityVC, animated: true, completion: nil)
}
I am having issues w/rendering UIActivityViewController.
Using the following code:
let objectsToShare: NSArray = ["test", "http://www.test.com"];
let activityVC: UIActivityViewController = UIActivityViewController(activityItems: objectsToShare as [AnyObject], applicationActivities: nil)
self.presentViewController(activityVC, animated: true, completion: nil)
renders the following ActivityViewController:
Anyone has faced similar issue and knows a workaround?
Also, sometimes the rendering issue becomes even worse: