EDIT
Starting from 2017-07-19, WhatsApp for iOS no longer interprets <br>as a new line and instead switches to \n.
This is not a backward compatible change, so if you use <br>, you will literally get it Some<br>Text. The following code should no longer be used; the good news is that you don’t have to do anything: WhatsApp will handle \nit as it should always be.
RECOMMENDED
I used my own UIActivityItemProvider, which, depending on the action selected, uses \neither <br>:
@interface ShareManager : UIActivityItemProvider <UIActivityItemSource>
@end
@implementation ShareManager
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType
id result = [self getShareText];
if ([activityType containsIgnoringCase:@"WhatsApp"])
{
result = [result stringByReplacingOccurrencesOfString:@"\n" withString:@"<br>"];
}
return result;
}
@end
Using:
UIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:@[[[ShareManager alloc] init]]];
[self presentViewController:activity animated:YES completion:nil];
source
share