Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11962] iOS: Facebook requestWithGraphPath fails the second time a post is sent to the user's timeline

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionWon't Fix
Resolution Date2013-01-17T15:42:24.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 02 API, 2013 Sprint 02
ComponentsiOS
Labelsn/a
ReporterDavide Cassenti
AssigneeVishal Duggal
Created2012-12-05T13:06:18.000+0000
Updated2013-03-27T22:28:26.000+0000

Description

Problem description

When trying to post something on the user's timeline using requestWithGraphPath, the call only works the first time (after authorize has been called). The following times, this error is returned:
{"type":"result","source":{},"error":"The operation couldn’t be completed. (facebookErrDomain error 10000.)","path":"me/feed","success":false,"graph":true}

Steps to reproduce

Use the following code to verify the problem (change [APPID]):
Ti.Facebook.appid = '[APPID]';
Ti.Facebook.permissions = ['publish_stream'];

var win = Ti.UI.createWindow({
    background: 'white',
    layout: 'vertical'
});

var button = Ti.UI.createButton({ title : 'fb login' });
button.addEventListener('click', function() {
    Ti.Facebook.authorize();
});

var post = Ti.UI.createButton({ title : 'send post' });
post.addEventListener('click', postFeed);

Ti.Facebook.addEventListener('login', function(e) {
    if (!e.success) {
        alert('fb not logged in');
    }
});

win.add(button);
win.add(post);

function postFeed() {
    var fbData = {
        caption : "Test report to FB",
        message : "text to send to FB timeline from test iPhone app"
    };
    Ti.Facebook.requestWithGraphPath('me/feed', fbData, 'POST', function(ef) {
        Ti.API.info(JSON.stringify(ef));
        if (ef.error) {
            alert(ef.error);
        } else {
            alert("upload to FB successful!");
        }
    });
}

win.open();
First time, clicking the send button (after login) works fine; then, it will never work again. Note that clicking again the login button won't fire the 'login' event anymore as well.

Comments

  1. Vishal Duggal 2013-01-17

    This is the full error coming from facebook. Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0xa697b00 {error={ code = 506; "error_data" = { kError = 1455006; }; message = "(#506) Duplicate status message"; type = OAuthException; }} (#506) Duplicate status message means that you have posted a message in a small period of time from a previous one Switched the sample to change the message every time and the error went away. Going to mark this as wont fix.

JSON Source