viezel / TiSocial.Framework

iOS6+ Social.Framework. Appcelerator apps are able to share content to Facebook and Twitter.
MIT License
259 stars 102 forks source link

I am able to share (image + text) with whats app in iOS. #173

Closed mitulbhalia closed 5 years ago

mitulbhalia commented 6 years ago

Hi,

I need to share image + text in one of my app but i am not able to share both together wit this module in iOS. I am using latest 1.8.4 version. I can share it separately but am not able to share both.

Please let me know the solution.

Thank you.

av-k commented 6 years ago
        const xhr = Ti.Network.createHTTPClient({
           onload: function () {
              const f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'image.jpg');
              if (!f.exists()) f.createFile();
              f.write(this.responseData);
              SocialShareWidget.share({
                 status: 'Check out me on #blablabla',
                 image: f.resolve(),
                 androidDialogTitle: 'Check out me'
              });
           },
           onerror: function (e) {
              console.error('[UI] Could not downloaded image: ' + e.error);
           }
        });
        xhr.open('GET', thumbSrc);
        xhr.send();

Simple example how get temporary image and after sharing that. I hope it will be useful, for me this approach works on Titanium SDK 7+ (iOS).