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:
Related
I am excluding .postToWeibo but still I can see Weibo app in the options of UIActivityViewController. My code is
var activityViewController = UIActivityViewController(activityItems: [documentId+".pdf", pDfdata], applicationActivities: nil)
activityViewController.excludedActivityTypes = [.postToTwitter, .postToFacebook, .postToFlickr, .postToTencentWeibo, .postToVimeo, .postToWeibo]
present(activityViewController, animated: true)'''
Can you please let me know what is the reason for this?
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 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)
I'm developing an iOS application using swift and firebase.
I'm trying to add sharing ability, where the user can share some information from firebase to social networkings apps.
Here's the button I added:
#IBAction func text2share(sender: AnyObject) {
let text2share = "Check out this 😍✨ \r\n Business Name: \(self.BusinessNameL.text!) \r\n Phone: \(self.PhoneNumberTV.text!) \r\n Category: \(self.CategoryL.text!) \r\n Website: \(self.Website1TV.text!) \r\n in Business Wallet app 📲"
let objects2Share = [text2share]
let activityVC = UIActivityViewController(activityItems: objects2Share, applicationActivities: nil)
self.presentViewController(activityVC, animated: true, completion: nil)
}
When I tried it, it worked for all social networks apps except for whatsapp and Facebook!
*Here's the error I got when I try to share it to whatsapp:
*Here's What I got when I share to Facebook:
And the link is empty!
Is there anybody know how can I solve this?
And why this happens?
It's a bug on whatsapp.
Check this
thread. It discusses the same. It seems like a very recent bug as earlier the same methods used to work. Check this answer by santhu for possible workaround or wait since they have admitted to resolve the bug.
if you try this code, you can share just the URL which I was talking about.
let textToShare = "Check out this Business Name"
let appURL = NSURL(string: "http://www.google.com")! as NSURL
let objectsToShare = [textToShare, appURL]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
//New Excluded Activities Code
activityVC.excludedActivityTypes = [UIActivityTypeAirDrop, UIActivityTypeAddToReadingList]
self.presentViewController(activityVC, animated: true, completion: nil)
if you want to share your text via facebook add excludeActivities
let activityVC = UIActivityViewController(activityItems: objects2Share, applicationActivities: nil)
let excludeActivities = [UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, UIActivityTypeMessage, UIActivityTypeMail]
activityVC.excludedActivityTypes = excludeActivities
self.presentViewController(activityVC, animated: true, completion: nil)