Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2061] [iOS] Facebook logout

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2013-03-04T20:17:09.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator Modules
Labelsn/a
ReporterTommy Leung
AssigneeMauro Parra-Miranda
Created2013-02-27T18:18:30.000+0000
Updated2016-03-08T07:41:01.000+0000

Description

Calling Ti.Facebook.logout causes an error "FBSession: should only be used from a single thread". Since the "startup" function is running on the main thread, the "logout" function should be called on the main thread as well by using "TiThreadPerformOnMainThread", in this file: https://github.com/appcelerator/titanium_modules/blob/master/facebook/mobile/ios/Classes/FacebookModule.m This is probably quite important as the logout functionality no longer works in the latest builds.

Attachments

FileDateSize
Screen Shot 2013-03-05 at 3.21.01 PM.png2013-03-05T20:25:38.000+0000146445

Comments

  1. Jamie Buckley 2013-03-04

    Hi Tommy, Can you provide some further information on this issue - Titanium Studio/SDK version - Operating System Could you also provide a small reproducible test case that will allow us to verify this issue. Thank you for your assistance. Jamie
  2. Tommy Leung 2013-03-04

    Ti SDK: 3.1.0 CI OS: iOS6 1. Click login and and sign in to fb. 2. Click logout and error message shows up Also as a side, after logout is successful and user tries to login again, it still keeps the previous user.
       // this sets the background color of the master UIView (when there are no windows/tab groups on it)
       Titanium.UI.setBackgroundColor('#000');
       
       var win1 = Titanium.UI.createWindow({  
           title:'Tab 1',
           backgroundColor:'#fff'
       });
       
       var button = Ti.UI.createButton({
       	title: 'logout'
       });
       button.addEventListener('click', function(){
       	Ti.Facebook.logout();
       })
       
       win1.add(button);
       
       var button2 = Ti.UI.createButton({
       	title: 'login',
       	top: 90,
       });
       button2.addEventListener('click', function(){
       	Ti.Facebook.authorize();
       })
       
       win1.add(button2);
       
       win1.open();
       
       
       Ti.Facebook.appid = '495338853813822';
       Titanium.Facebook.permissions = ['publish_stream'];
       Ti.Facebook.forceDialogAuth = true;
       
       Ti.Facebook.addEventListener('login', function(e) {
           if (e.success) {
               alert('Logged In');
           } else if (e.error) {
               alert(e.error);
           } else if (e.cancelled) {
               alert("Canceled");
           }
       });
       
       Ti.Facebook.addEventListener('logout', function(e) {
           alert('Logged out');
       });
       
  3. Jamie Buckley 2013-03-05

    Hi Tommy, In the 3.1.0 build of titanium facebook has been moved to its own module and so will not work, I would suggest using a GA build if you would like to use this API at the moment
  4. Tommy Leung 2013-03-05

  5. Alexander Frischbutter 2013-04-07

    have the same problem using fb.auth in one file and try to logout later in another.
  6. Daniel Sefton 2013-04-07

    Did you try the fix from TIMOB-12828? You'll need to use the latest CI build.

JSON Source