我試圖在swift中共享圖像和文本。但是當我選擇通過Facebook,Messenger或WhatsApp共享時,它只會提供文本(圖像不共享)。我正在使用UIActivityViewController進行共享。如何在swift中共享圖像和文本?
這裏是我的代碼:
func displayShareSheet(latitude:NSString?, longitude:NSString?, image:UIImage?, address:NSString?) {
let activityViewController = UIActivityViewController(activityItems: [(latitude as NSString?)!, (longitude as NSString?)!, (image as UIImage?)!, (address as NSString?)!], applicationActivities: nil)
presentViewController(activityViewController, animated: true, completion: {}
)
}
你可以試試這個http://stackoverflow.com/questions/35931946/basic-example-for-sharing-text-or-image-with-uiactivityviewcontroller-in-swift –
這將共享圖像或文本。我希望這兩件事能夠共享。 @Sanjeetverma – hussain
看到我的答案在下面! –