I'm using Titanium SDK 3.1.0 and I can't login to Facebook in both iOS and Android. I get different error messages in both.
In Android, I'm getting the following error in logcat when trying to log in to facebook using the Facebook Module from Titanium:
E/FacebookModule(29188): (main) [114509,241940] LoginDialogListener onFacebookError: null E/FacebookModule(29188): com.facebook.android.FacebookError E/FacebookModule(29188): at com.facebook.android.Facebook.onSessionCallback(Facebook.java:433) E/FacebookModule(29188): at com.facebook.android.Facebook.access$000(Facebook.java:97) E/FacebookModule(29188): at com.facebook.android.Facebook$2.call(Facebook.java:379) E/FacebookModule(29188): at com.facebook.Session$3$1.run(Session.java:1239) E/FacebookModule(29188): at android.os.Handler.handleCallback(Handler.java:605) E/FacebookModule(29188): at android.os.Handler.dispatchMessage(Handler.java:92) E/FacebookModule(29188): at android.os.Looper.loop(Looper.java:137) E/FacebookModule(29188): at android.app.ActivityThread.main(ActivityThread.java:4424) E/FacebookModule(29188): at java.lang.reflect.Method.invokeNative(Native Method) E/FacebookModule(29188): at java.lang.reflect.Method.invoke(Method.java:511) E/FacebookModule(29188): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) E/FacebookModule(29188): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) E/FacebookModule(29188): at dalvik.system.NativeStart.main(Native Method) E/FacebookModule(29188): (main) [7,241947] onAuthFail: nullThis is the code I'm using to try to login into facebook:
var fb = require('facebook'); fb.appid = FACEBOOK_APP_ID; fb.permissions = ['publish_stream']; fb.forceDialogAuth = true; fb.addEventListener('login', function(e) { if (e.success) { socialFacebook.image = imagesPath + "kinedu_0000_btn_FB.png"; } else if (e.error) { alert('Error: ' + e.error); } else if (e.cancelled) { alert("Canceled"); } }); var socialFacebook = Ti.UI.createImageView({ image:imagesPath + "kinedu_0000_btn_FB.png", left:"5%", bottom:10, right:Ti.Platform.displayCaps.platformWidth/2 }); function socialFacebookTouchStart() { var animateTouchStart = Ti.UI.createAnimation({ bottom:9, duration:200 }); socialFacebook.animate(animateTouchStart); } function socialFacebookTouchEnd() { var animateTouchEnd = Ti.UI.createAnimation({ bottom:10, duration:200 }); socialFacebook.animate(animateTouchEnd); animateTouchEnd.addEventListener("complete", function(e){ if(fb.loggedIn) { //open facebook posting window alert('logged in to facebook'); var openPostingOnFacebookMainView = Ti.UI.createAnimation({ opacity:1, duration:250 }); var openPostingOnFacebookViewAnimation = Ti.UI.createAnimation({ opacity:1, top:0, duration:250 }); postingOnFacebookView.animate(openPostingOnFacebookViewAnimation); openPostingOnFacebookViewAnimation.addEventListener("complete", function(e){ postingOnFacebookMainView.animate(openPostingOnFacebookMainView); }); } else { alert('not logged in') fb.authorize(); } }); } socialFacebook.addEventListener("touchstart", socialFacebookTouchStart); socialFacebook.addEventListener("touchend", socialFacebookTouchEnd);I have a view that should trigger an event to login into facebook when it is touched, if the login is succesful then it should display another view. But the call to Facebook fails and I get that error message.
In iOS, the code is almost the same, except that the module is initiated differently to use the iOS 6 built-in Facebook login:
var fb = require('facebook'); fb.appid = 548069311920318; fb.permissions = ['read_stream']; fb.forceDialogAuth = false;But with this, I get the following error:
User cancelled the login process.
. How could I had cancelled the process if the only thing I'm doing is just to click on the view to log in?
This is my first time working with the Facebook Module, I'm following the examples presented in the documentation and I have no idea why am I getting these errors on both Android and iOS. I will appreciate any help you can provide.