Facebook library loading fail

Hi! I’m trying to build my game with a facebook library. But still getting black screen and this error:

Feb 10 19:56:55 MacBook-Pro-Kirumbik.local code[7301] <Warning>: Runtime error

    module ‘facebook’ not found:resource (facebook.lu) does not exist in archive

        no field package.preload[‘facebook’]

        no file ‘/Users/kirumbik/Library/Application Support/iPhone Simulator/7.0.3/Applications/2AA73E14-A39B-4401-9C1A-26312EDB1BE5/code.app/facebook.lua’

        no file ‘/Users/kirumbik/Library/Application Support/iPhone Simulator/7.0.3/Applications/2AA73E14-A39B-4401-9C1A-26312EDB1BE5/code.app/facebook.lua’

        no file ‘./facebook.so’

        no file '/Users/kirumbik/Library/Application Support/iPhone Simulator/7.0.3/Applications/2AA73E14-A39B-4401-9C1A-26312EDB1BE5/code.app/facebook.so’facebook

    stack traceback:

        [C]: in function ‘require’

        ?: in function ‘require’

        /Users/kirumbik/projects/Game/main.lua:7: in main chunk

Hi @kirumbik,

Are you using Corona daily build #2165 or later? If so, you need to include Facebook as a plugin. We had to do this because of a recent change in Apple’s approval policies.

Just include this in your “build.settings” file and Facebook should work as normal:

[lua]

settings = {

    plugins =

    {

        [“facebook”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { iphone = true },

        },

    },

}

[/lua]

Best regards,

Brent

Thank you for response Brent! But I’m still having the same error on simulator…

Hi @kirumbik,

Which version of Corona? And which version of OS X? 

Corona 2014.2170, OS X 10.9

Hmmm, this is odd. Can you restart the Simulator and then see if the problem persists?

Yep, still the same

Hey,

We’ve just updated the plugin.  Can you please try building and trying on the simulator again?  Thanks.

@kirumbik, try to cut-n-paste the plugins table on the top of the settings table in build.settings file, before iphone or Android settings - I know it sounds strange, but I had a similar problem and this move made a trick

I think I"m having a similar issue (build  2014.2185, osx 10.9.1, iOS simulator 7.0 (463.9.4.2))

After I wasn’t able to get my app working, I tried to run the sample facebook app.  I changed the facebookAppID to mine.  I have the same problem as my app… black screen.

I also tried whammy’s suggestions of cut-n-pasting the plugins table above the other settings tables in build.settings.

Any ideas?  kirumbik - did you every figure out your issue?

Thanks!

Can you post your build.settings file?

local FacebookAppID = "111111111111111" settings = { orientation = { default = "portrait", supported = { "portrait"} }, plugins = { ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs", }, }, iphone = { plist = { UIStatusBarHidden = true, CFBundleShortVersionString = "0.2.24", CFBundleVersion = "0.0.5", CFBundleIdentifier = "com.myapp.dev", UIPrerenderedIcon = true, UIApplicationExitsOnSuspend = false, CFBundleDisplayName = "myapp", CFBundleIconFile = "Icon.png", MinimumOSVersion = "5.0", UIAppFonts = { }, FacebookAppID = FacebookAppID, CFBundleURLTypes = { { CFBundleURLSchemes = { "fb" .. FacebookAppID, }, }, }, CFBundleIconFiles = { "Icon.png" , "Icon-72.png", "Icon-512.png", "Icon@2x.png" }, }, components = {} }, android = { versionCode = "10", usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_FINE\_LOCATION", "android.permission.ACCESS\_COARSE\_LOCATION", "android.permission.CAMERA", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, usesFeatures = { { name = "android.hardware.location", required = false }, { name = "android.hardware.location.gps", required = false }, { name = "android.hardware.location.network", required = false }, { name = "android.hardware.camera", required = true }, { name = "android.hardware.camera.front", required = false }, }, intentFilters = { { label = "myapp", actions = { "android.intent.action.VIEW" }, categories = { "android.intent.category.DEFAULT", "android.intent.category.BROWSABLE", }, data = { scheme = "myapp" }, }, }, }, }

@gjaman that’s the problem… you are trying to add LUA code inside a build.settings (its not a LUA file)

remove the following:

local FacebookAppID = "111111111111111"

add this under plugins:

["facebook"]={ publisherId = "com.coronalabs", supportedPlatforms = { iphone = true }, },&nbsp;

and fix the following under iphone plist with:

FacebookAppID="XXXXXXXXXXXXX", FacebookDisplayName="Name of Your App", CFBundleURLTypes={{CFBundleURLSchemes={"fbXXXXXXXXXXXXX"}}}, ["URL types"]={ ["Item 0"]={ ["URL Schemes"]={ ["Item 0"]="fbXXXXXXXXXXXXX" }, }, },

I just added that lua code recently after reading this thread:

http://forums.coronalabs.com/topic/44603-facebook-issues/#entry232460

I tried your suggestions this morning and still a no go.  I also can’t get the sample facebook app to work.  I would have thought that should work out of the box with just replacing the facebookAppID

I must be missing something simple…

My suggestion is to test the sample app and put your AppID in the places where it’s expected.  Use the build.settings as the sample app has them (other than adding your appID) and add your appID to the right place in the Lua code and try it.

You also have to make sure all of your setup on the Facebook side is correct.

I reviewed all settings again.  It looks like everything is correct.  It still does not work in the simulator, but it does work on the device.

In the simulator I get a black screen.  The new facebook plugin works in the iOS simulator right? 

Facebook has never worked on the simulator.  The plugin shouldn’t black screen you on the Sim through.  Look for errors in your console log.

Rob

Uh??? Facebook does work on the iOS Sim - just not the Corona Simulator?!?

Well it seems to for me at least.

It’s been a while since I debugged my facebook module… I swear I used to use the iOS Sim to debug.  

I"m aware it never worked in corona sim. 

recap:

Corona simulator = no black screen, see the sample app, but unable to connect to facebook (as expected)

iOS simulator = black screen.  

Device = no black screen, able to connect to facebook (works as expected)

Sorry.  Mis-read.  It should work on the iOS sim.

@gjaman, what device are you simulating on the iOS simulator?

Can you open the Console app on your mac and look through the messages for errors (that’s where the iOS simulator dumps your Lua prints)

Rob