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

Twitter image problem #41

Open Astrovic opened 11 years ago

Astrovic commented 11 years ago

I can not render the image when I use twitter. I tried both with a remote image that with a local image, but the image is not never displayed.

viezel commented 11 years ago

Please show me your code

Astrovic commented 11 years ago

this is the code. I've try with blob, local and remote image

//var image = Titanium.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,"image.jpg").read()    
if(Social.isTwitterSupported()){ //min iOS5 required
    Social.twitter({
        text:"message text...",
        image : Ti.Filesystem.applicationDataDirectory+"image.jpg", // image,
        //image:"http://ilgrillotalpa.files.wordpress.com/2012/01/twitter.png",
        //image:"KS_nav_ui.png"
        url:"http://www.google.com"
    });
}
FokkeZB commented 11 years ago

I have the same issue, both local and remote

viezel commented 11 years ago

okay this is retarted. I do see the same behaviour here. The super odd thing is that it works for Social.facebook() which is the same function in my module. look here: https://github.com/viezel/TiSocial.Framework/blob/master/Classes/DkNappSocialModule.m#L270 Plus it looks like it is behind the placeholder foto.

I really dont know how to fix this... have you testet this is another iOS version? like 6.0? what about older version of my module?

sorry, im not very helpful.

FokkeZB commented 11 years ago

I remember having the same issue with another module like yours. Isn't it so that the Twitter implementation wants a blob instead of a path?

By the way; did you see my wrapper lib? I want to extend it to provide as much clever fallbacks for devices and OS versions as possible: https://gist.github.com/FokkeZB/5458506

FokkeZB commented 11 years ago

I remember having the same issue with another module like yours. Isn't it so that the Twitter API wants a blob?

By the way, did you see my wrapper lib? I'm extending it into a one to all share lib, with lots of fallbacks:

https://gist.github.com/FokkeZB/5458506

viezel commented 11 years ago

HI Fokke, Twitter discontinued their 1.x API and are only using the newer. Im actually not sure which one is used in the iOS Social.framework. Nice wrapper. Im not a big fan of big wrappers, but I can see the idea of people that does not want to get into all the sharing posibilities. :)

btw, this is incorrect: https://gist.github.com/FokkeZB/5458506#file-share-js-L92 You need a method for doing the compare.

/**
 * Compare SDK version.
 * function returns true if first argument is equal or higher than second argument
 * @example versionCompare( "2.0.1","2.0");
 * @param {String} Version
 * @param {String} Version
 * @return {Boolean} Result
 */
versionCompare = function(left, right) {
    if (typeof left + typeof right != 'stringstring')
        return false;  
    var a = left.split('.'), b = right.split('.'), i = 0, len = Math.max(a.length, b.length);   
    for (; i < len; i++) {
        if ((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i]))) {
            return true;
        } else if ((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i]))) {
            return false;
        }
    }
    return true; //equal
}

Back to the issue. ill try to look at the twitter api, but im quite sure this feature have worked all the time :S

viezel commented 11 years ago

the docs wants an UIImage: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/SLComposeViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40012205

raulriera commented 11 years ago

I think the problem here is that you are using an URL as well... and silly iOS puts the "URL placeholder" on top of the image (happened to me before)

FokkeZB commented 11 years ago

Nope, if I leave out the URL it doesn't get the image neither.

ygbr commented 11 years ago

are you guys observing photo_size_limit ?

FokkeZB commented 11 years ago

@ygbr I've used pictures of various sizes, including 140x140 to 800x1600.

jmargolese commented 11 years ago

I did get all images to load, for all services but messages. I've reduced the size to 100x100, but it still doesn't show. Does anyone know if the messages sharing supports MMS/images?

Any suggestions help would be appreciated!

thx

 if (Social.isActivityViewSupported()) {//min iOS6 required
        logger.info("image dir: " + Ti.Filesystem.applicationDataDirectory);
        Social.activityView({
            text : "share like a king!",
            image : Ti.Filesystem.applicationDataDirectory + "instagram80.png",     
            removeIcons : "print,sms,copy,contact,camera,weibo"
        }, [{
            title : "Instagram",
            type : "hello.world",
            image : Ti.Filesystem.applicationDataDirectory + "instagram80.png"
              // '/images/instagram80.png'
              // Ti.Filesystem.resourcesDirectory + 'images/instagram80.png
        }]);
    } else {
        //implement fallback sharing..
    }
owensgit commented 10 years ago

I'm also having this problem. I opened up a Stack Overflow question about it: http://stackoverflow.com/questions/22797836/titanium-js-cannot-use-an-image-stored-in-sqlite-database-in-tisocial-module

Has there been any updates?