Sharing text with NewLine issues in whatsapp iOS swift
Solution:
If you are used to share the text with common sharing with \n whatsapp will not accept it.Other sharing apps will be allow \n character.So try the following method to share the data in Whatsapp.
If you are used to share the text with common sharing with \n whatsapp will not accept it.Other sharing apps will be allow \n character.So try the following method to share the data in Whatsapp.
func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: String) -> Any {
if activityType.contains("WhatsApp") {
sharetext = sharetext.replacingOccurrences(of: "\n", with: "<\n >")
}
return sharetext
}
Comments
Post a Comment