Reputation: 11761
Has anyone tried to use the code here: https://developers.google.com/+/mobile/ios/share/basic-share
My impression is that it makes it possible to share a URL publicly available on the net, but not a URL to a local image (that I would like to share). I hope someone will tell me I am wrong and show me why.
When I try it in order to share an image on Google+, it complains with a message saying: "That link is invalid"
I use this kind of code to make the local URL (as I always do): let imageURL = NSURL(string: “MY_LOCAL_URL”
Upvotes: 0
Views: 446
Reputation: 61
As per documentation there are only 2 params available URL and Language Code.
So for displaying image, it will require to upload image on server, then use that URL.
I wanted to put some text also along with URL, but no documented param available. "text" param is working, but can stop work anytime.
Upvotes: 1
Reputation: 14571
I used this code way back in Google share and its working.
let shareBuilder = GPPShare.sharedInstance().nativeShareDialog()
GPPShare.sharedInstance().delegate = self
//URL Share
shareBuilder.setURLToShare(NSURL(string: "http://images.all-free-download.com/images/graphiclarge/daisy_pollen_flower_220533.jpg"))
//Prefilling Text
shareBuilder.setPrefillText("Hi hello")
shareBuilder.open()
The URL image I entered is live on internet. Go to your Google + account and see the image is shared.
For sharing a local image we can use this
shareBuilder.attachImage(UIImage(named: "yourImage.png"))
rather than using setURLToShare
There are other methods in which you can attach a video too.
I have checked the code for attachImage
and its working fine.
Upvotes: 0