can't exclude UIActivityTypePostToFacebook from [UIActivityViewController excludedActivityTypes] can't exclude UIActivityTypePostToFacebook from [UIActivityViewController excludedActivityTypes] ios ios

can't exclude UIActivityTypePostToFacebook from [UIActivityViewController excludedActivityTypes]


Try this way

// sharing items in an array lets say sharingItemsNSArray *sharingItems = @[@"hello", @"how", @"are", @"You."];//making UIActivityViewController object lets say avcUIActivityViewController *avc = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];//exclude UIActivityTypePostToFacebook avc.excludedActivityTypes = @[UIActivityTypePostToFacebook];//presenting UIActivityViewController in our case avc[self presentViewController:avc animated:YES completion:nil];

see the below picture, Facebook is not included

In image Facebook not included

When commenting avc.excludedActivityTypes = @[UIActivityTypePostToFacebook]; Facebook again becomes visible in share option

When commenting  avc.excludedActivityTypes = @[UIActivityTypePostToFacebook]; Facebook again becomes visible in share option


//Hope this helps . This is how it is done in Swift 3.  //  When Including the FB Option the code is as follow:      func otherSharing() {            let activityItem: [AnyObject] = [returnFinalImage() as AnyObject]            let avc = UIActivityViewController(activityItems: activityItem as [AnyObject], applicationActivities: nil)             avc.excludedActivityTypes = [UIActivityType.addToReadingList, UIActivityType.assignToContact, UIActivityType.print, UIActivityType.saveToCameraRoll, UIActivityType.copyToPasteboard, UIActivityType.airDrop, UIActivityType.postToTwitter]            self.present(avc, animated: true, completion: nil)        }    //When Excluding the FB Option the code is as follow:        func otherSharing() {            let activityItem: [AnyObject] = [returnFinalImage() as AnyObject]            let avc = UIActivityViewController(activityItems: activityItem as [AnyObject], applicationActivities: nil)             avc.excludedActivityTypes = [UIActivityType.addToReadingList, UIActivityType.assignToContact, UIActivityType.print, UIActivityType.saveToCameraRoll, UIActivityType.copyToPasteboard, UIActivityType.airDrop, UIActivityType.postToFacebook, UIActivityType.postToTwitter]            self.present(avc, animated: true, completion: nil)        }    //I have Added Screen shot : [![enter image description here][1]][1]      [1]: https://i.stack.imgur.com/IGzqC.jpg


matomo