Cannot read property 'getLoginStatus' of undefined at CheckLoginStatus (app.js:19)



  • Hello,
    I implemented Monaca Facebook login example in my app and I got this error when I run it on my android phone:
    app.js:19 Uncaught (in promise) TypeError: Cannot read property ‘getLoginStatus’ of undefined
    at CheckLoginStatus (app.js:19)
    at app.js:35
    at Object.ons.ready (onsenui.min.js:6)
    at Object.<anonymous> (app.js:34)
    at Object.invoke (angular.min.js:sourcemap:41)
    at S.instance (angular.min.js:sourcemap:89)
    at p (angular.min.js:sourcemap:65)
    at g (angular.min.js:sourcemap:58)
    at angular.min.js:sourcemap:58
    at Class._compileAndLink (angular-onsenui.min.js:2)



  • any ideas?



  • @Ahmed-Elshorbagy Are you doing a debug build?



  • Yes, is that wrong?


  • Monaca

    @Ahmed-Elshorbagy
    Based on your error, it seems like you are running the project on a standard Monaca Debugger. In other word, the getLoginStatus method of the Facebook plugin is called before the plugin is loaded or when the plugin is not found. However, this should work fine without this error if you test it on build app or custom debugger.

    Can you try testing it on custom debugger?



  • @khemry no, I created an app with visual studio and installed it on phone but I was debugging it on chrome


  • Monaca

    @Ahmed-Elshorbagy
    So you installed a debug build app on your phone and debugged it on Chrome?



  • No. I debug on my pc



  • I installed a debug version of the app and test it on my phone and used chrome inspect tool to see any errors on the inspection tool on chrome on my PC


  • Monaca

    @Ahmed-Elshorbagy
    I see. That’s why you got this error. This plugin can’t be tested on your PC or Browser. You need to test it on your device. Please use Monaca Custom Debugger.



  • I installed an apk on my phone directly, I attached the device to my PC to inspect the errors through chrome


  • Monaca

    @Ahmed-Elshorbagy
    I see. I want to confirm one thing. Please run the app on your device without debugging it. Do you still get the same error?



  • Yes


  • Monaca

    @Ahmed-Elshorbagy
    Hi,
    I’ve tested the Facebook sample app again and had no such issue.
    I’ve just realized that you are building your app using Monaca for Visual Studio. If that is the case, this might be the reason why. We have discontinued the support as well as development for Monaca for Visual Studio for several months already. Therefore, there might be some unknown errors while building your app via this service. We apologize for any inconveniences related to this. Would you please transfer your project to Monaca Localkit instead?


Log in to reply