I would like director to change scenes once facebook reports that it is logged in. Facebook logs in fine, but when it bounces back to the app director does not change scenes. My code:
local facebook = require "facebook"
if (\_G.appId) then
print(11111)
print(\_G.appId )
local function fbListener()
--EXECUTE AFTER SUCCESSFUL LOGIN
if ( "login" == event.phase ) then
facebook.request( "me/friends" )
-- Fetch access token for use in Facebook's API
local access\_token = event.token
print( access\_token )
e.target.scene = 'mainMenu';
e.target.transition = "fade";
changeScene(e);
end
end
facebook.login( \_G.appId, fbListener, {"publish\_stream"} );
else
local function onComplete( event )
system.openURL( "http://developers.facebook.com/setup" );
controller:createMainUser(fbid, fbname)
end
native.showAlert( "Error", "To develop for Facebook Connect, you need to get an application ID from Facebook's website.", { "Learn More" }, onComplete );
end
end
Any help would be greatly appreciated. [import]uid: 10903 topic_id: 23667 reply_id: 323667[/import]
director:changeScene(“mainMenu”, “fade”)
I looks like you’re trying to call a generic changeScene function not the director’s changeScene function. [import]uid: 9840 topic_id: 23667 reply_id: 95067[/import]
I have the director call bound to a function in a controller file, so the way I am changing is fine.
Turns out I’m not hitting the event.phase of login, and have not yet figured out why. Anyone with Facebook experience able to chime in on this would be awesome. [import]uid: 10903 topic_id: 23667 reply_id: 95085[/import]
Thanks for your help. That helped narrow it down further. The login event.phase that is returning is login failed. The url schemes work in relaunching the app so the facebook appid is correct and the facebook app is initialized with the app’s info. I am logging into facebook with the correct user name and password so it is not clear why I would get a login failed. [import]uid: 10903 topic_id: 23667 reply_id: 95217[/import]
Just an update, found a mismatch between the bundle identifier on facebook side and the bundle ID I was using. Having trouble using the data I get back from Facebook, seems to be JSON, but not being able to test on the simulator is really killer. Anyone have any examples on how to use the info from a request “me” facebook call? [import]uid: 10903 topic_id: 23667 reply_id: 95374[/import]
I think the current Facebook posting sample actually has an example of that; or have you already scoured that?
RE the simulator, it’s a bit of a pain but at least you can use Xcode sim without always having to do device. (I get irritated by iTunes always launching when I plug in ;)) [import]uid: 52491 topic_id: 23667 reply_id: 95396[/import]
Hey, @crssmn, glad to hear it worked out for you. When you get the Twitter working, let me know how you’ve implemented. The ones I looked at appear to be either broken or use a method that doesn’t quite appeal to me so far…