Software Archive
Read-only legacy content
17061 Discussions

Facebook Login IOS

Sascha_B_
Beginner
818 Views

Hello,

i have a problem implenting the facebook plugin.

I use this code and have testet several Plugin versions with no other result.

On Android, the Code works well and the login is ok.

....
    $('#facebookLogin').on('click', function () {

        var $permissions = ["email"];


            console.log = function (e) {
                alert(JSON.stringify(e));
            }
            console.error = function (e) {
                alert(JSON.stringify(e));
            }
        console.log("FB:Try to Login");
        facebookConnectPlugin.login($permissions, facebookSuccess, facebookFailure)
    });
.....

function facebookSuccess(data) {
    var $fbToken = data.authResponse.accessToken;
    var $fbUserId = data.authResponse.userID;
    window.localStorage.setItem("facebookId", data.authResponse.userID);
    console.log(data);
    facebookConnectPlugin.api("/me?fields=id,email,gender,last_name,first_name", [], function (result) {
            console.log(result);
            createUserAccount(result, $fbToken, $fbUserId);
        },
        facebookFailure);

}

function createUserAccount(result, token, userId) {
  console.log(result);
  console.log(token);
  console.log(userId);
}
function facebookFailure(data) {
    console.log(data);
}

On Ios, no window appears, the appScreen is hidden for a moment, then my app appears again. But it hangs and nothing can be done.

Sometimes, the first .login works, but the .api request fails.

Also, there is no console output on IOS. I test it with testflight.The console.log is redirected to nslog in order to test.

The only NSLOG there is in relation...

Apr 22 15:40:53 Reemts-iPhone timed[18698] <Notice>: (Error) CoreTime: Error requesting proactive time check job
Apr 22 15:40:53 Reemts-iPhone Facebook[18681] <Warning>: Unbalanced calls to begin/end appearance transitions for <FBTopBarAndContentViewController: 0x15c94e30>.
Apr 22 15:40:54 Reemts-iPhone MobileMail[18688] <Warning>: Received memory warning.
Apr 22 15:40:54 Reemts-iPhone locationd[69] <Notice>: Gesture EnabledForTopClient: 1 (SiriCalled)
Apr 22 15:40:59 Reemts-iPhone Facebook[18681] <Warning>: -canOpenURL: failed for URL: "moments://" - error: "(null)"
Apr 22 15:40:59 Reemts-iPhone Storyspot[18622] <Warning>: Received memory warning.
Apr 22 15:41:00 Reemts-iPhone Facebook[18681] <Warning>: -canOpenURL: failed for URL: "moments://" - error: "(null)"
Apr 22 15:41:04 Reemts-iPhone Storyspot[18622] <Warning>: Received memory warning.


Apr 22 15:41:05 Reemts-iPhone Facebook[18681] <Error>: LaunchServices: disconnect event received for service com.apple.lsd.mapdb
Apr 22 15:41:05 Reemts-iPhone Facebook[18681] <Error>: LaunchServices: disconnect event received for service com.apple.lsd.openurl
<!---- WHITE SCREEN DISAPPEARS>
Apr 22 15:41:05 Reemts-iPhone mediaserverd[43] <Notice>: '' storyspotwkverlag(pid = 18622) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Apr 22 15:41:51 Reemts-iPhone Storyspot[18734] <Warning>: Apache Cordova native platform version 3.8.0 is starting.
Apr 22 15:41:51 Reemts-iPhone Storyspot[18734] <Warning>: Multi-tasking -> Device: YES, App: YES
Apr 22 15:41:51 Reemts-iPhone Storyspot[18734] <Warning>: Unlimited access to network resources
Apr 22 15:41:51 Reemts-iPhone routined[18712] <Warning>: Timed out waiting on the CarKit service
Apr 22 15:41:52 Reemts-iPhone Storyspot[18734] <Warning>: [CDVTimer][splashscreen] 350.143015ms
Apr 22 15:41:52 Reemts-iPhone Storyspot[18734] <Warning>: [CDVTimer][localnotification] 3.584981ms
Apr 22 15:41:52 Reemts-iPhone Storyspot[18734] <Warning>: [CDVTimer][localnotification] 0.069022ms
Apr 22 15:41:52 Reemts-iPhone MobileMail[18729] <Notice>: (Note ) MC: Loaded Message.framework
Apr 22 15:41:52 Reemts-iPhone Storyspot[18734] <Warning>: [CDVTimer][socialsharing] 221.140981ms
Apr 22 15:41:53 Reemts-iPhone Storyspot[18734] <Warning>: [CDVTimer][file] 28.026998ms
Apr 22 15:41:53 Reemts-iPhone Storyspot[18734] <Warning>: [CDVTimer][statusbar] 51.838994ms
Apr 22 15:41:53 Reemts-iPhone Storyspot[18734] <Warning>: Init FacebookConnect Session
Apr 22 15:41:53 Reemts-iPhone Storyspot[18734] <Warning>: [CDVTimer][facebookconnectplugin] 79.183042ms
Apr 22 15:41:53 Reemts-iPhone Storyspot[18734] <Warning>: [CDVTimer][TotalPluginStartup] 737.901986ms

Apr 22 15:42:07 Reemts-iPhone Storyspot[18734] <Error>: -[WebActionDisablingCALayerDelegate willBeRemoved]: unrecognized selector sent to instance 0x16677560
Apr 22 15:42:07 Reemts-iPhone Storyspot[18734] <Warning>: *** WebKit discarded an uncaught exception in the webView:willRemoveScrollingLayer:withContentsLayer:forNode: delegate: <NSInvalidArgumentException> -[WebActionDisablingCALayerDelegate willBeRemoved]: unrecognized selector sent to instance 0x16677560

The app starts completely from start after facebook login...

What can i do??

IOS Version is 9.0

King regards,

Sascha

 

0 Kudos
4 Replies
Amrita_C_Intel
Employee
818 Views

Use this plugin instead of facebook connect

https://github.com/jeduan/cordova-plugin-facebook4

0 Kudos
Sascha_B_
Beginner
818 Views

Hi,

thanks for the answer. I have testet the Plugin. 

If there is no native Facebook app on the IPhone, it works. When the Facebook app is installed, there is the same error as before. The last screen is shown, but the WebView don't react anymore.

Apr 23 15:08:12 Reemts-iPhone Storyspot[19171] <Warning>: viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
Apr 23 15:08:12 Reemts-iPhone SpringBoard[14702] <Warning>: Memory level is not normal or this app was killed by jetsam. Pending auto-relaunch of '<FBApplicationProcess: 0x14748890; MobileMail; pid: -1>'.
Apr 23 15:08:12 Reemts-iPhone SpringBoard[14702] <Warning>: Memory level is not normal or this app was killed by jetsam. Pending auto-relaunch of '<FBApplicationProcess: 0x17896440; WhatsApp; pid: -1>'.
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "bolt://instagram" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "fb-groups://" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "hyperlapse://instagram" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "instagram://" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "fbmentions://" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "fb-pma://" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "fb-paper://" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "tango://" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "rooms://" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "slingshot://navigate" - error: "(null)"
Apr 23 15:08:42 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "fb255620677933453://" - error: "(null)"

Apr 23 15:09:00 Reemts-iPhone Facebook[19191] <Warning>: Unbalanced calls to begin/end appearance transitions for <FBTopBarAndContentViewController: 0x16cdb770>.
Apr 23 15:09:08 Reemts-iPhone SpringBoard[14702] <Warning>: Memory level is not normal or this app was killed by jetsam. Pending auto-relaunch of '<FBApplicationProcess: 0x16d3f2f0; WhatsApp; pid: -1>'.
Apr 23 15:09:10 Reemts-iPhone ReportCrash[19238] <Warning>: saved type '109_WhatsApp' report (2 of max 25) as /var/mobile/Library/Logs/CrashReporter/WhatsApp_2016-04-23-150905_Reemts-iPhone.ips
Apr 23 15:09:10 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "moments://" - error: "(null)"
Apr 23 15:09:12 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "moments://" - error: "(null)"
Apr 23 15:09:12 Reemts-iPhone Facebook[19191] <Warning>: -canOpenURL: failed for URL: "moments://" - error: "(null)"
Apr 23 15:11:28 Reemts-iPhone routined[19299] <Warning>: Timed out waiting on the CarKit service
Apr 23 15:11:29 Reemts-iPhone Storyspot[19317] <Warning>: Apache Cordova native platform version 3.8.0 is starting.
Apr 23 15:11:29 Reemts-iPhone Storyspot[19317] <Warning>: Multi-tasking -> Device: YES, App: YES
Apr 23 15:11:29 Reemts-iPhone Storyspot[19317] <Warning>: Unlimited access to network resources
Apr 23 15:11:30 Reemts-iPhone Facebook[19268] <Warning>: Received memory warning.
Apr 23 15:11:31 Reemts-iPhone Storyspot[19317] <Warning>: [CDVTimer][splashscreen] 958.861053ms
Apr 23 15:11:31 Reemts-iPhone Storyspot[19317] <Warning>: [CDVTimer][localnotification] 7.498980ms
Apr 23 15:11:31 Reemts-iPhone Storyspot[19317] <Warning>: [CDVTimer][localnotification] 0.057995ms
Apr 23 15:11:31 Reemts-iPhone kernel[0] <Notice>: xpcproxy[19319] Container: /private/var/mobile/Containers/Data/Application/A73B1808-E91E-41D7-9DBE-F15F4C0A02B1 (sandbox)
Apr 23 15:11:33 Reemts-iPhone MobileMail[19319] <Notice>: (Note ) MC: Loaded Message.framework
Apr 23 15:11:33 Reemts-iPhone Storyspot[19317] <Warning>: timeout messaging Mail to determine CanSendMail state
Apr 23 15:11:33 Reemts-iPhone Storyspot[19317] <Warning>: [CDVTimer][socialsharing] 2039.619982ms
Apr 23 15:11:33 Reemts-iPhone Storyspot[19317] <Warning>: [CDVTimer][file] 22.174954ms
Apr 23 15:11:33 Reemts-iPhone Storyspot[19317] <Warning>: [CDVTimer][statusbar] 90.229034ms
Apr 23 15:11:33 Reemts-iPhone Storyspot[19317] <Warning>: Init FacebookConnect Session
Apr 23 15:11:33 Reemts-iPhone Storyspot[19317] <Warning>: [CDVTimer][facebookconnectplugin] 66.398025ms
Apr 23 15:11:33 Reemts-iPhone Storyspot[19317] <Warning>: [CDVTimer][TotalPluginStartup] 3189.136028ms

 

0 Kudos
Amrita_C_Intel
Employee
818 Views

Hello,

It should not happen. Try this exiting Facebook sample https://github.com/gomobile/sample-facebook-connect

And check if you are getting same error. 

0 Kudos
Amrita_C_Intel
Employee
818 Views

And it is also present in XDK under samples and demos.

0 Kudos
Reply