Login with Facebook Error

I’ve been trying to figure out the bug I have when using the login with Facebook option. I’ve set up the app at Facebook and followed the code examples here. The bug is below. Any insight would be appreciated.

2016-09-18 20:21:56.611 Falling[19093:2779068] -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2016-09-18 20:21:58.831 Falling[19093:2779068] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[2]'
*** First throw call stack:
(
0 CoreFoundation 0x00000001102cc34b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010fd2d21e objc_exception_throw + 48
2 CoreFoundation 0x00000001101dc3b3 -[__NSPlaceholderArray initWithObjects:count:] + 275
3 CoreFoundation 0x00000001101e35c4 +[NSArray arrayWithObjects:count:] + 52
4 Falling 0x000000010c28313b -[UserService loginWithFacebookSocialUserId:accessToken:expirationDate:permissions:fieldsMapping:responder:] + 225
5 Falling 0x000000010c2817bd -[UserService loginWithFacebookSDK:fieldsMapping:responder:] + 164
6 Falling 0x000000010c24325e _TFC7Falling11AppDelegate11applicationfTCSo13UIApplication4openV10Foundation3URL17sourceApplicationGSqSS_10annotationP__Sb + 3326
7 Falling 0x000000010c243c70 _TToFC7Falling11AppDelegate11applicationfTCSo13UIApplication4openV10Foundation3URL17sourceApplicationGSqSS_10annotationP__Sb + 368
8 UIKit 0x000000010e4eaae3 __45-[UIApplication _applicationOpenURL:payload:]_block_invoke + 940
9 UIKit 0x000000010e4ea472 -[UIApplication _applicationOpenURL:payload:] + 757
10 SafariServices 0x000000011070b060 -[SFSafariViewController remoteViewController:hostApplicationOpenURL:] + 155
11 SafariServices 0x0000000110702db7 -[SFBrowserRemoteViewController willOpenURLInHostApplication:] + 68
12 CoreFoundation 0x000000011025305c __invoking___ + 140
13 CoreFoundation 0x0000000110252ee1 -[NSInvocation invoke] + 289
14 FrontBoardServices 0x0000000112f7c76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
15 FrontBoardServices 0x0000000112f7c5e4 -[FBSSerialQueue _performNext] + 189
16 FrontBoardServices 0x0000000112f7c96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
17 CoreFoundation 0x0000000110271311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
18 CoreFoundation 0x000000011025659c __CFRunLoopDoSources0 + 556
19 CoreFoundation 0x0000000110255a86 __CFRunLoopRun + 918
20 CoreFoundation 0x0000000110255494 CFRunLoopRunSpecific + 420
21 GraphicsServices 0x000000011376ba6f GSEventRunModal + 161
22 UIKit 0x000000010e4dff34 UIApplicationMain + 159
23 Falling 0x000000010c2452af main + 111
24 libdyld.dylib 0x00000001111bc68d start + 1
25 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Hi Jon,

Did you change the URL Scheme per the documentation at (See the “Requirements” section):
https://backendless.com/documentation/users/ios/users_facebook_login.htm

Regards,
Mark

Jon, did you use easyLoginFacebook… or loginWithFacebookSDK?

I used loginWithFaceBookSDK so I did not edit the URL Scheme since this appears to be for easyLoginFacebook.

Please try our sample project (see in attachment). You could investigate how login with Facebook SDK have to be organized. Pay attention to Info.plist options.

TestFacebookSDKLogin.zip (20.11MB)

Thank you. I’ll take a look asap. I appreciate the help.

I believe the issue I am having is that I am using iOS 10 and Swift 3.0. The methods in the example are deprecated. Does Backendless support Swift 3.0 at this point?

There is our Swift 3 sample project in attachment, please try it.

TestS3FacebookSDKLogin.zip (20.18MB)

I tested the code for Swift 3.0. While the app no longer crashes, the sample code returns an error with token = nil when the user attempts to login with Facebook.

Are you seeing the same thing on your end? Do you get nil for your token?

I am still receiving a nil value for the token when trying to log in with Facebook. I’ve done the following.

  1. Cleared the user at Backendless.
  2. Reset the Content and Settings on the simulator.
  3. Deleted the app from Facebook.

Any ideas?

Update the latest Backendless SDK (pod 3.0.41) and try again.

I’ve updated to 3.0.41 and have taken all of the steps I took above. I am still receiving the token == nil error.

There is our working sample, please try it with your Facebook account.

If it don’t work, could you provide your Facebook login/password, which demonstrates the problem, on support@backendless.com (marked with topic name)? We need to reproduce this issue with it.

TestS3FacebookSDKLogin.zip (20.21MB)

I am still receiving an error with log in. The token is reported as nil.

The Facebook Account info is below.

jonthornham@gmail.com
password: password1234

Here is the error code info.

2016-10-04 12:25:18.889703 TestS3FacebookSDKLogin[1494:106570] [] nw_endpoint_start_tls_while_connected [3.1 31.13.65.1:443 ready socket-flow (satisfied)] Attached TLS protocol to connected flow
2016-10-04 12:25:18.889954 TestS3FacebookSDKLogin[1494:106570] [] nw_endpoint_resolver_receive_report [3 graph.facebook.com:443 ready resolver (satisfied)] received child report:[3.1 31.13.65.1:443 in_progress socket-flow (satisfied)]
2016-10-04 12:25:18.890215 TestS3FacebookSDKLogin[1494:106570] [] nw_connection_endpoint_report [3.1 31.13.65.1:443 in_progress socket-flow (satisfied)] reported event flow:start_secondary_connect
2016-10-04 12:25:18.890503 TestS3FacebookSDKLogin[1494:106570] [] nw_connection_endpoint_report [3 graph.facebook.com:443 in_progress resolver (satisfied)] reported event flow:start_secondary_connect
2016-10-04 12:25:18.890797 TestS3FacebookSDKLogin[1494:106570] [] nw_endpoint_resolver_receive_report [3 graph.facebook.com:443 in_progress resolver (satisfied)] received child report:[3.1 31.13.65.1:443 in_progress socket-flow (satisfied)]
2016-10-04 12:25:18.891140 TestS3FacebookSDKLogin[1494:106570] [] nw_connection_endpoint_report [3.1 31.13.65.1:443 in_progress socket-flow (satisfied)] reported event flow:start_connect
2016-10-04 12:25:18.891386 TestS3FacebookSDKLogin[1494:106570] [] nw_connection_endpoint_report [3 graph.facebook.com:443 in_progress resolver (satisfied)] reported event flow:start_connect
2016-10-04 12:25:18.891609 TestS3FacebookSDKLogin[1494:106570] [] nw_endpoint_flow_protocol_connected [3.1 31.13.65.1:443 in_progress socket-flow (satisfied)] Transport protocol connected
2016-10-04 12:25:18.891828 TestS3FacebookSDKLogin[1494:106570] [] nw_endpoint_resolver_receive_report [3 graph.facebook.com:443 in_progress resolver (satisfied)] received child report:[3.1 31.13.65.1:443 in_progress socket-flow (satisfied)]
2016-10-04 12:25:18.892068 TestS3FacebookSDKLogin[1494:106570] [] nw_connection_endpoint_report [3.1 31.13.65.1:443 in_progress socket-flow (satisfied)] reported event flow:finish_transport
2016-10-04 12:25:18.892302 TestS3FacebookSDKLogin[1494:106570] [] nw_connection_endpoint_report [3 graph.facebook.com:443 in_progress resolver (satisfied)] reported event flow:finish_transport
2016-10-04 12:25:19.146898 TestS3FacebookSDKLogin[1494:106570] [] nw_endpoint_flow_protocol_connected [3.1 31.13.65.1:443 in_progress socket-flow (satisfied)] Output protocol connected
2016-10-04 12:25:19.147616 TestS3FacebookSDKLogin[1494:106570] [] nw_endpoint_flow_connected_path_change [3.1 31.13.65.1:443 ready socket-flow (satisfied)]
2016-10-04 12:25:19.147945 TestS3FacebookSDKLogin[1494:106570] [] nw_endpoint_flow_connected_path_change [3.1 31.13.65.1:443 ready socket-flow (satisfied)] Connected path is satisfied
2016-10-04 12:25:19.148310 TestS3FacebookSDKLogin[1494:106570] [] nw_endpoint_resolver_receive_report [3 graph.facebook.com:443 in_progress resolver (satisfied)] received child report:[3.1 31.13.65.1:443 ready socket-flow (satisfied)]
2016-10-04 12:25:19.148631 TestS3FacebookSDKLogin[1494:106570] [] nw_connection_endpoint_report [3.1 31.13.65.1:443 ready socket-flow (satisfied)] reported event flow:finish_connect
2016-10-04 12:25:19.148937 TestS3FacebookSDKLogin[1494:106570] [] nw_connection_endpoint_report [3 graph.facebook.com:443 ready resolver (satisfied)] reported event flow:finish_connect
2016-10-04 12:25:19.149339 TestS3FacebookSDKLogin[1494:106447] [] __tcp_connection_start_block_invoke 3 sending event TCP_CONNECTION_EVENT_TLS_HANDSHAKE_COMPLETE in response to state ready and error (null)
2016-10-04 12:25:19.149623 TestS3FacebookSDKLogin[1494:106447] [] tcp_connection_event_notify 3 event: TCP_CONNECTION_EVENT_TLS_HANDSHAKE_COMPLETE, reason: nw_connection event, should deliver: true
2016-10-04 12:25:19.150050 TestS3FacebookSDKLogin[1494:106447] [] tcp_connection_get_statistics DNS: 28ms/30ms since start, TCP: 127ms/162ms since start, TLS: 259ms/419ms since start
2016-10-04 12:25:19.351199 TestS3FacebookSDKLogin[1494:106830] [] nw_socket_handle_socket_event Event mask: 0x4
2016-10-04 12:25:19.351552 TestS3FacebookSDKLogin[1494:106831] [] tcp_connection_cancel 3
2016-10-04 12:25:19.351881 TestS3FacebookSDKLogin[1494:106830] [] nw_socket_handle_socket_event Socket received WRITE_CLOSE event
2016-10-04 12:25:19.352221 TestS3FacebookSDKLogin[1494:106830] [] nw_endpoint_handler_cancel [3 graph.facebook.com:443 ready resolver (satisfied)]
2016-10-04 12:25:19.352517 TestS3FacebookSDKLogin[1494:106830] [] nw_endpoint_handler_cancel [3.1 31.13.65.1:443 ready socket-flow (satisfied)]
2016-10-04 12:25:19.352873 TestS3FacebookSDKLogin[1494:106830] [] __nw_socket_service_writes_block_invoke sendmsg(fd 10, 31 bytes): socket has been closed
2016-10-04 12:25:19.353117 TestS3FacebookSDKLogin[1494:106830] [] nw_endpoint_flow_protocol_error [3.1 31.13.65.1:443 cancelled socket-flow (null)] Socket protocol sent error: [32] Broken pipe
2016-10-04 12:25:19.353401 TestS3FacebookSDKLogin[1494:106830] [] nw_endpoint_flow_protocol_disconnected [3.1 31.13.65.1:443 cancelled socket-flow (null)] Output protocol disconnected
2016-10-04 12:25:19.353672 TestS3FacebookSDKLogin[1494:106830] [] nw_resolver_cancel_on_queue 0x60000011b630
2016-10-04 12:25:19.353917 TestS3FacebookSDKLogin[1494:106830] [] -[NWConcrete_tcp_connection dealloc] 3
2016-10-04 12:25:28.270243 TestS3FacebookSDKLogin[1494:106390] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
AppDelegate (iOS9 >) -> application:openURL: Optional("fb1187550204598587"), [com.apple.SafariViewService -> nil]
ERROR: token = nil

Was anyone able to look into the Facebook account I am using to test? I still am not able to create accounts with Facebook Login. The error is persisting.

We checked your test account with our sample project (see in attachment), and login is done.

Here is a log:
http://support.backendless.com/public/attachments/0dc3945810839184f396cd21ff33ee1f.png</img>
and result on app dashboard:
http://support.backendless.com/public/attachments/af93d150b65ef3ecf243fb586fa601a9.png</img>

Please try your test account with our sample project, how do it work for you?

TestS3FacebookSDKLogin.zip (20.21MB)

Maybe something wrong with your facebook app (fb1187550204598587)? Could you try with another app?

I’ve retested and have tried all of your suggestions. Even when I use your test app I am presented with the error. Are you able to see an account with my name in your DB?

Yes, I am able to see an account with your name in my DB - see the second screenshot above.

Please provide your appID here, I check our sample with your backendless app.