Facebook login dead on iOS

Testing my app on an iPod touch 4G, using build 2189. The Facebook login function works perfectly on Android, but does nothing on iOS. Basically the listener is never being called so there is no popup of any kind appearing.

I’ve also tried with the demo Facebook code bundled with Corona, and that has the same issue. Whatever button I click, no listener is called, it just does nothing. Please help!

Here is the code (appID removed for security):


local facebook = require(“facebook”)

local fbAppID = “xxxxxxxxxx”  --replace with your Facebook App ID

facebook.login( fbAppID, facebookListener, { “publish_actions, email” } )

local json = require( “json” )

local function facebookListener( event )

    print( “event.name”, event.name )  --“fbconnect”

    print( “event.type:”, event.type ) --type is either “session”, “request”, or “dialog”

    print( "isError: " … tostring( event.isError ) )

    print( "didComplete: " … tostring( event.didComplete ) )

end


And my build settings are here:

– ORIENTATION VALUES:

– portrait, portraitUpsideDown, landscapeLeft, landscapeRight

 settings = {

    plugins =

    {

        [“facebook”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { iphone=true, [“iphone-sim”]=true },

        },

    },

– iOS SETTINGS:

    iphone = {

        components = {},

        plist = {

            CFBundleDisplayName = “My App”,

            MinimumOSVersion=“5.1”,

            UIStatusBarHidden = false,

            UIPrerenderedIcon = true,

            UIApplicationExitsOnSuspend = false,

            CoronaUseIOS6LandscapeOnlyWorkaround=true,

            CoronaUseIOS6IPadPhotoPickerLandscapeOnlyWorkaround=true,

          

            FacebookAppId  = “xxxxxxxxx”,

            CFBundleURLTypes =

             {

                {

                    CFBundleURLSchemes =

                    {

                        “fbxxxxxxxxxxxx”

                    }

                }

             },

    

            }

        },

    }


Are you getting any errors in your device’s console log?  You are testing on device and not the simulator right?  If you need help trying to read the console log, please read: http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Thanks

Rob

Nope nothing in the console at all. I’m testing on the device, an iPod touch running iOS 6.1.6, and using the Console in XCode to read the output. I put a debug line in the Facebook login listener to see if that prints out but it doesn’t, so the plugin appears to not be calling the listener at all.

If I run it in the simulator, it does show the ‘Facebook.login does not work in the simulator’ error in the console, as expected.

Do me a favor and move the facebook.login() call after the definition of the listener function.

Rob

I tried that but it didn’t work sadly.
 
I’ve put together a new app which I’ve attached which is just the default Corona generated app with my code in the build.settings and the main.lua, so everything stripped down.

It still doesn’t work for me (the console never shows the debug code at the top of the listener), although occasionally (not every time) I get the following error:
 
“FBSession: No AppID provided; either pass an AppID to init, or add a string valued key with the appropriate id named FacebookAppID to the bundle *.plist”
 
I’ve definitely added the AppID to the settings though as you’ll see in the app so that’s a bit strange.
 
If you could run the app on your systems against 2189 and see if anything happens, or check my code for a mistake and see what I need to change to get it working, that would be great. If it works for you guys then it’s going to be a problem with my test device rather than a Corona issue. Thanks again.

The primary issue you are having has to do with the fact that you have the facebook code commented out in your build.settings.

However, I’m still getting a crash when it’s trying to login.  I think this is something local to me (since I don’t have access to build an app for your setup).  But it’s trying to login.

Rob

OK I’ve solved it, you were right that I hadn’t removed the comments from the build, and in my original file it came down to me camel-casing the variable as FacebookAppId instead of FacebookAppID. 

Changing all that it now works fine. Thanks so much for the assistance and sorry for the time it took to look into this.

Are you getting any errors in your device’s console log?  You are testing on device and not the simulator right?  If you need help trying to read the console log, please read: http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Thanks

Rob

Nope nothing in the console at all. I’m testing on the device, an iPod touch running iOS 6.1.6, and using the Console in XCode to read the output. I put a debug line in the Facebook login listener to see if that prints out but it doesn’t, so the plugin appears to not be calling the listener at all.

If I run it in the simulator, it does show the ‘Facebook.login does not work in the simulator’ error in the console, as expected.

Do me a favor and move the facebook.login() call after the definition of the listener function.

Rob

I tried that but it didn’t work sadly.
 
I’ve put together a new app which I’ve attached which is just the default Corona generated app with my code in the build.settings and the main.lua, so everything stripped down.

It still doesn’t work for me (the console never shows the debug code at the top of the listener), although occasionally (not every time) I get the following error:
 
“FBSession: No AppID provided; either pass an AppID to init, or add a string valued key with the appropriate id named FacebookAppID to the bundle *.plist”
 
I’ve definitely added the AppID to the settings though as you’ll see in the app so that’s a bit strange.
 
If you could run the app on your systems against 2189 and see if anything happens, or check my code for a mistake and see what I need to change to get it working, that would be great. If it works for you guys then it’s going to be a problem with my test device rather than a Corona issue. Thanks again.

The primary issue you are having has to do with the fact that you have the facebook code commented out in your build.settings.

However, I’m still getting a crash when it’s trying to login.  I think this is something local to me (since I don’t have access to build an app for your setup).  But it’s trying to login.

Rob

OK I’ve solved it, you were right that I hadn’t removed the comments from the build, and in my original file it came down to me camel-casing the variable as FacebookAppId instead of FacebookAppID. 

Changing all that it now works fine. Thanks so much for the assistance and sorry for the time it took to look into this.