In my application I used UIActivityViewController
to share text in Whatsapp, Facebook and Twitter etc.
I am working in iOS 9 and Xcode Version 7.2. When
I had that problem.. It is caused most probably by using NSString instead of NSURL, here is a working code:
-(void) share {
NSString* shareText = @"Sharing an eddress with you";
NSURL *website = [NSURL URLWithString:@"http://eddress.co/EDDRSS"];
NSArray *shareArray = @[shareText, website];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:shareArray applicationActivities:nil];
[activityVC setValue:@"Someone shared an eddress with you" forKey:@"subject"];
NSArray *excludeActivities = @[UIActivityTypeAirDrop,
UIActivityTypePrint,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo];
activityVC.excludedActivityTypes = excludeActivities;
[self.navigationController presentViewController:activityVC animated:YES completion:nil];
}