FAQ Database Discussion Community


Core Data and a UIActivityViewController

objective-c,core-data,nsmutablearray,nsarray,uiactivityviewcontroller
I have my app that is using core data to persist data. I have a UIActivityViewController setup on my main VC. Everything is working as I expect it to. My question is when you go to grab items from a core data model, how do you have it give you...

Unable to added Facebook and Twitter to UIActivityViewController

ios,objective-c,iphone,share,uiactivityviewcontroller
Trying to share application on social median, and email, and message. Since Email and message is working fine for me. But Facebook,and twitter is not all showing to UIActivityViewController Below is code which i try. NSArray *excludeActivities = @[UIActivityTypeAirDrop, UIActivityTypePostToFacebook, UIActivityTypePostToTwitter]; UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[string, URL] applicationActivities:nil]; activityViewController.excludedActivityTypes...

Completion Handler deprecated for UIActivityViewController

ios,uitableview,ios8,uiactivityviewcontroller
I am using a UIActivityViewController to share content from within my app. When the activity is completed, I want to turn off the UITableView editing mode. However looking at the documentation I saw that the completionHandler property of UIActivityViewController has been deprecated as of iOS 8.0. There is no deprecation...

iOS: Warning “attempt to present ViewController whose view is not in the window hierarchy”

ios,objective-c,uiactivityviewcontroller,presentviewcontroller,uiview-hierarchy
I am getting following warning when I try to present a ActivityController on navigation controller, Attempt to present <UIActivityViewController: 0x15be1d60> on <UINavigationController: 0x14608e80> whose view is not in the window hierarchy! I have tried to present view controller by following code, UIActivityViewController * activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities]; activityController.excludedActivityTypes...

iOS: How to share text and image on social networks?

ios,facebook,share,uiactivityviewcontroller
Please, can you tell me if I'm doing mistakes? NSString *sharedMsg=[NSString stringWithFormat:@"Hello world"]; UIImage* sharedImg=[UIImage imageNamed:@"image"]; NSArray* sharedObjects=[NSArray arrayWithObjects:sharedMsg, sharedImg, nil]; UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:sharedObjects applicationActivities:nil]; activityViewController.popoverPresentationController.sourceView = self.view; [self presentViewController:activityViewController animated:YES...

Sharing PDF file form WebView Xcode

xcode,swift,uiactivityviewcontroller
hi i have tried with this code but didn't worked var pdfLoc = NSData(contentsOfURL: NSURL(string: "http://www.triestetrasporti.it/download.php?f=c113b7c217cdffd07ee371678a8f8699&target=0.pdf")!) var oggetti = [pdfLoc] let activityViewController : UIActivityViewController = UIActivityViewController(activityItems: oggetti, applicationActivities: nil) Error : Cannot find an initializer for type 'UIActivityViewController' that accepts an argument list of type '(activityItems: [NSData?], applicationActivities: nil)'...

Error : 'AnyObject?' is not identical to 'AnyObject'

swift,uiactivityviewcontroller,vcard
I am trying to share the contact .vcf file using UIActivityViewController. But I am getting 'AnyObject?' is not identical to 'AnyObject' Below is my line of Code : let dirs : [String]? = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true) as? [String] if ((dirs) != nil) { let dir = dirs![0]; //documents directory let...

Facebook text share not working with UIActivityViewController

ios,objective-c,facebook,uiactivityviewcontroller,iphone-6
Well, the situation is when I am trying to share text in facebook with UIActivityViewController, the share text shows blank in the facebook popup whereas the URL provided comes but text doesn't show in Facebook share dialog or popup. One more thing sometimes the URL also don't come or show...

UIActivity activityViewController crash on iPad in Swift

ios,ipad,swift,uipopovercontroller,uiactivityviewcontroller
I have the following code below to toggle UIActivityViewController @IBAction func shareButtonClicked(sender: UIButton) { let textToShare = "Text" if let myWebsite = NSURL(string: "http://www.example.com/") { let objectsToShare = [textToShare, myWebsite] let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil) self.presentViewController(activityVC, animated: true, completion: nil) } } But it crashes on iPad. How...

UIActivityViewController not passing new line characters to some activities

ios,objective-c,iphone,uiactivityviewcontroller,whatsapp
I am using the following code to set up UIActivityViewController: NSArray *activityItems = [NSArray arrayWithObjects:[self textMessageToShare], nil]; UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil]; [activityViewController setCompletionHandler:^(NSString *activityType, BOOL completed) { if (completed) { [self sendFeedbackWithIndexPath:indexPath AndLikeType:100 AndCell:nil]; } }]; [self.navigationController...

Other apps not allowed in UIActivityViewController?

ios,objective-c,uiactivityviewcontroller
I'm working on an iOS app in Objective-C and I'm currently trying to make a sharing extension with a UIActivityViewController. I understand that there is an enum of activity that I can individually exclude from the UIActivityViewController with a property of type NSArray called excludedActivityTypes. How can I also exclude...

How to include an Objective-C Extension in my Swift ActivityViewController?

ios,objective-c,swift,uiactivityviewcontroller,ios8-extension
I have included the 1Password extension in my Browser app by following this question. However, I already have an iOS 8 Share Sheet (ActivityViewController) on my app and would like to include the 1Password inside this share sheet inside of using it's own. My app is in Swift but the...

objective-c presentViewController position

ios,objective-c,uiactivityviewcontroller
I have thus UIActivityViewConroller like so: - (IBAction)Share:(id)sender { NSData *pdfData = [NSData dataWithContentsOfFile:self.pdfPath]; UIActivityViewController * activityController = [[UIActivityViewController alloc] initWithActivityItems:@[pdfData] applicationActivities:nil]; activityController.popoverPresentationController.sourceView = self.NavBar; [self presentViewController:activityController animated:YES completion:nil]; } My issue is this shows up on the left side of self.NavBar, I would like to position it to the...

UIActivityViewController not showing body text in gmail

ios,objective-c,uiactivityviewcontroller
I'm using uiactivityviewcontroller for showing sharing option. Everything working except when user selects the Gmail sharing option. If user chooses email then it shows the content properly. But if i choose gmail then nothing is displayed in the body text. Here is the code: NSString *str = [NSString stringWithFormat:@"%@",@"Check the...

How to share multiple urls via UIActivityViewController?

ios,objective-c,cocoa-touch,uikit,uiactivityviewcontroller
This is my code: NSArray* itemsToShare = [self itemsToShare:items]; // array of NSURLs if (itemsToShare.count) { UIActivityViewController* activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil]; UIViewController* controller = self.platformManager.sharePanel.navigationController.topViewController; [controller presentViewController:activityVC animated:YES completion:nil]; } If itemsToShare.count is greater than 1 UIActivityViewController doesn't show Facebook and Twitter icons. If the array...

Pinterest sharing with App Pin

ios,objective-c,swift,uiactivityviewcontroller,pinterest
How would I, using the share sheet, share a UIImage on Pinterest and have it link to my app. So that Pinterest users could install my app directly from the Pinterest app? http://blog.pinterest.com/post/110786995184/install-the-best-new-iphone-and-ipad-apps-from I can do do manually on my mac. Using the Pinterest browser button I can pin an...

how to share different urls via uiactivityviewcontroller?

ios,xcode,share,analytics,uiactivityviewcontroller
I am trying to use UIActivityViewController share different URLs for each item. e.g. For twitter : www.google.com ; For Facebook : www.bing.com I know that I can customize the text for each one but I can't seem to find a way to customize the url for each one. I've tried...

Share your device screen with UIActivityViewController

swift,uiactivityviewcontroller
as the question suggests, I'm looking for a way to share the current device screen when using UIActivityViewController. Here's my code so far. @IBAction func buttonShareTapped(sender: UIButton) { let textToShare = "Here's my text to be shared!" // Generate the screenshot UIGraphicsBeginImageContext(view.frame.size) view.layer.renderInContext(UIGraphicsGetCurrentContext()) var image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() var imageToShare...