Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

New Facebook Module won't work on iOS - works fine on Android

$
0
0

Hi guys,

Can anyone please put me out of my misery and explain what I need to do differently for iOS please?

This all works just fine on Android. I've added what I need to the plist section of my tiapp.xml and my app successfully performs an external log in via facebook using the socialIntegrations functions...

On android I see on facebook a normal post with the image and url and description (although no caption now I mention it)

On iOS all I get is anything the user writes themselves in the share dialog. All 'attachments' (so to speak) are missing.

Here's my code:

facebookPost = function(){
 
    gender = (myPlayerData.gender === "male")? "him!" : "her!";
 
    data = {
        link: "www.facebook.com/TheGame",
        picture: attachedImage,
        name: "TheGame",
        caption: "See if you can beat " + gender + " - FREE on Android and iOS.",
        description: myDescription
    };
 
 
    if (!fbShareEventListener) {
        fbShareEventListener = true;
        fb.addEventListener('shareCompleted', function(e){ shareFunction(e); });
    };
 
    if (fb.canPresentShareDialog){
        fb.presentShareDialog(data);
    } else{
        fb.presentWebShareDialog(data);
    };
 
};  //  End Facebook Post
 
shareFunction = function(e){
 
alert(JSON.stringify(e));
 
    //fb.removeEventListener('shareCompleted', function(e){ shareFunction(e); }); 
    //(I took this out as it seems to make it crash!)
 
    if (e.success) {
        facebookView.backgroundImage = '/Images/FacebookButtonFade.png';
            addCoins.on(facebookCoins, facebookBonusPost, function(outcome){
            myGameAlerts.on(":)", "Posted To Your Wall");
            prepareToRestart();
        });
    } else if (e.error){
        facebookView.backgroundImage = '/Images/FacebookButton.png';
        myGameAlerts.on(":(", "Facebook Error!\n" + e.error);
        prepareToRestart();
    } else if (e.cancelled) {
        facebookView.backgroundImage = '/Images/FacebookButton.png';
        myGameAlerts.on(":(", "Cancelled!");
    };
 
};

Then additionally, on Android I post an image direct to the player's wall.

On iOS I see in my Appcelerator console and error about blobs not being supported?

FBSDKLog: FBLinkShareParams: only "http" or "https" schemes are supported for link shares
FBSDKLog: Unsupported FBRequest parameter type: TiBlob
-[TiBlob _fastCharacterContents]: unrecognize selector sent to instance 0x19525ff0
The code works fine on Android:
postPicToFacebook = function(){
 
    data = null;
    data = {
        link: "www.facebook.com/TheGame",
        caption: "My Caption"
    };
 
    data.source = blobImage; // this is made elsewhere - remember, this whole Fn work fine on Android!  
 
    if (fb.permissions.indexOf('publish_actions') < 0 ){
        fb.requestNewPublishPermissions(['publish_actions'], fb.AUDIENCE_FRIENDS, function(p){
            if (p.success){
 
                fb.requestWithGraphPath('me/photos', data, 'POST', function(e){
                    if (e.success) {
                        addCoins.on(facebookCoins, facebookBonusPost, function(outcome){
                            myGameAlerts.on("Posted!", "Certificate Posted To Your Page");
                        });
                    } else if (e.error){
                        myGameAlerts.stayOn("Oops!", "Something Went Wrong!\nTry Logging Out Of Facebook And Then Log Back In" + e.error);
                    } else if (e.cancelled) {
                        myGameAlerts.on("Cancelled!","");
                    };
                });
            } else if (p.cancelled){
                myGameAlerts.stayOn("Cancelled! :(","You Can't Post Pictures For Your Friends Without Giving Permission!");
            } else {  // Error or anything else
                myGameAlerts.stayOn("Error! :(", "There is a problem with Facebook!");
            };
        });
    } else {  //  Permission already granted
        fb.requestWithGraphPath('me/photos', data, 'POST', function(e){
            if (e.success) {
                addCoins.on(facebookCoins, facebookBonusPost, function(outcome){
                    myGameAlerts.on("Posted!", "Certificate Posted To Your Page");
                });
            } else if (e.error){
                myGameAlerts.stayOn("Oops!", "Something Went Wrong!");
            } else if (e.cancelled) {
                myGameAlerts.on(":(","Cancelled!");
            };
        });
    };
 
};  //  End Post Pic To Facebook

Viewing all articles
Browse latest Browse all 8068

Trending Articles