Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7668] iOS: Facebook - login in with dialog produces (NSURLErrorDomain error -999.) error

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 1.7.5, Release 1.8.0.1, Release 1.8.1, Release 3.0.2
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterJon Alter
AssigneeUnknown
Created2012-02-15T13:10:11.000+0000
Updated2018-03-06T18:58:01.000+0000

Description

Logging into facebook using the facebook dialog causes this error "The operation couldn't be completed. (NSURLErrorDomain error -999.)".

Steps to reproduce:

Step 1: run the code below Step 2: click on the window Step 3: enter your facebook creds and hit Login Step 4: notice that the dialog closes Step 5: check the console and see the error below
{"type":"result","source":{},"error":"The operation couldn't be completed. (NSURLErrorDomain error -999.)","success":false,"cancelled":false}
Step 6: notice that the app will sometimes crash at this point Step 7: click the window again and you will already be logged in and ready to post
Titanium.Facebook.appid = '171500626234399';
Titanium.Facebook.permissions = ['publish_stream'];
var win = Ti.UI.createWindow({backgroundColor:'white'});
win.open();
win.addEventListener('click', function(){
	var data = {
	    link: "http://www.appcelerator.com",
	    name: "Appcelerator Titanium Mobile",
	    message: "Checkout this cool open source project for creating mobile apps",
	    caption: "Appcelerator Titanium Mobile",
	    picture: "http://developer.appcelerator.com/assets/img/DEV_titmobile_image.png",
	    description: "You've got the ideas, now you've got the power.",
	};
	Titanium.Facebook.dialog("feed", data, function(e) {
		Ti.API.info('## FB RESULT: '+JSON.stringify(e) );
	    if (e.success) {
	        alert("Success!  From FB: " + e.result);
	    } else {
	        if (e.error) {
	            alert(e.error);
	        } else if (e.cancelled) {
	            alert('Cancelled');
	        } else {
	            alert("Unkown result");
	        }
	    }
	});
});

Comments

  1. Neeraj Gupta 2012-02-16

    Jon - Is this a regression or a new issue?
  2. Pedro Enrique 2012-02-16

    Reproduced this error on 1.7.5 and 1.8.0.1
  3. Jon Alter 2012-02-16

    Works fine if you authorize before showing the dialog. The dialog will authorize you, but it can't authorize and post.
       Titanium.Facebook.appid = '171500626234399';
       Titanium.Facebook.permissions = ['publish_stream'];
       var win = Ti.UI.createWindow({backgroundColor:'white'});
       win.open();
       win.addEventListener('click', function(){
       	Titanium.Facebook.addEventListener('login', function(e) {
       	    if (e.success) {
       	        // alert('Logged In');
       			var data = {
       			    link: "http://www.appcelerator.com",
       			    name: "Appcelerator Titanium Mobile",
       			    message: "Checkout this cool open source project for creating mobile apps",
       			    caption: "Appcelerator Titanium Mobile",
       			    picture: "http://developer.appcelerator.com/assets/img/DEV_titmobile_image.png",
       			    description: "You've got the ideas, now you've got the power.",
       			};
       			Titanium.Facebook.dialog("feed", data, function(e) {
       				Ti.API.info('## FB RESULT: '+JSON.stringify(e) );
       			    if (e.success) {
       			        alert("Success!  From FB: " + e.result);
       			    } else {
       			        if (e.error) {
       			            alert(e.error);
       			        } else if (e.cancelled) {
       			            alert('Cancelled');
       			        } else {
       			            alert("Unkown result");
       			        }
       			    }
       			});
       	    } else if (e.error) {
       	        alert(e.error);
       	    } else if (e.cancelled) {
       	        alert("Cancelled");
       	    }
       	});
       	Titanium.Facebook.authorize();
       });
       

JSON Source