Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5091] iOS: Call Facebook.authorize() from alert dialog

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionWon't Fix
Resolution Date2011-11-18T11:34:37.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterWienke
AssigneeReggie Seagraves
Created2011-08-24T06:06:56.000+0000
Updated2011-11-18T11:34:58.000+0000

Description

Since 1.6.x to 1.7.x functionality with regards calling Ti.Facebook.authorize() does not work inside an alert dialog event listener.
Titanium.Facebook.appid =  "181219095251677";
Titanium.Facebook.permissions = ['publish_stream', 'read_stream', 'offline_access'];
 
facebookNotConnected = function() {
    if(Ti.Facebook.loggedIn === false) {
        var alertDialog = Titanium.UI.createAlertDialog({
            title : 'Facebook',
            message : 'You need to login with Facebook',
            buttonNames : ['Login Facebook', 'No Thanks']
        });
        alertDialog.addEventListener('click', function(e) {
            if(e.index === 0) {
                Titanium.Facebook.authorize();
            };
        });
        alertDialog.show();
    }
}
However, when the authorize call is placed in a setTimeout with at least 400ms, the authorize call works just fine. See Q&A: http://developer.appcelerator.com/question/124236/call-facebookauthorize-from-alert-dialog

Comments

  1. Wienke 2011-11-18

    Dear Appcelerator, Are there plans on fixing this. I think this is a widely used feature. Because the Facebook popup is familiar it is way more trusted then using the Graph API with a own UI. Kind regards, Wienke Giezeman
  2. Don Thorp 2011-11-18

    Launching a dialog from another dialog is not supported and not generally a good idea. Consider hiding the dialog and using an app level event to launch the FB dialog.

JSON Source