[TIMOB-12830] iOS Facebook v3 Module: Cannot create an event using the GRAPH API
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Benjamin Hatfield |
Assignee | Unknown |
Created | 2013-02-22T22:47:13.000+0000 |
Updated | 2018-02-28T20:03:43.000+0000 |
Description
REPRODUCTION:
Run the code below with 3.1.0 and the Facebook v3 module on the iOS simulator. After logging in, click the button to try and post an event.
RESULTS:
On the iOS platform, the API call fails. The console outputs:
{noformat}
[ERROR] : : HTTP status code: 400
{noformat}
and an alert dialog displays:
{noformat}
The operation couldn't be completed. (com.facebook.sdk error 5.)
{noformat}
On the Android platform, the GRAPH API call succeeds.
ADDITIONAL NOTES:
With 3.0.2.GA, the code runs OK on both Android and iOS.
The other examples mentioned in http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Facebook
work except the logout example for iOS (TIMOB-12828).
TEST CODE:
//var fb = Ti.Facebook;
var fb = require('facebook');
fb.appid = 495338853813822;
fb.permissions = ['create_event'];
fb.addEventListener('login', function(e) {
if (e.success) {
alert('Logged In');
} else if (e.error) {
alert(e.error);
} else if (e.cancelled) {
alert("Canceled");
}
});
var evt = Ti.UI.createButton({title: 'GRAPH Create Event'});
evt.addEventListener('click', function(e){
var starttime = new Date(2013, 4, 30, 17, 0);
var endtime = new Date(2013, 4, 30, 19, 0);
var title = "Barry's Birthday Celebration";
var description = "Barry will have a great party";
var data = {
start_time: JSON.stringify(starttime), // API expects a JSON stringified date
end_time: JSON.stringify(endtime),
summary: description,
name: title
};
fb.requestWithGraphPath('me/events', data, 'POST', function(e) {
if (e.success) {
alert("Success! Returned from FB: " + e.result);
} else {
if (e.error) {
alert(e.error);
} else {
alert("Unknown result");
}
}
});
});
var win = Ti.UI.createWindow({backgroundColor: 'white'});
win.add(evt);
win.open();
if (!fb.loggedIn) {
fb.authorize();
}
Found some new information. Investigating.
Also tried using the reauthorize method. Did not work for creating an event, but did work for posting a status update.