Facebook Module

Hi,

with 2015.2748 Build Facebook doesn’t work.

When start game console says:

Oct 24 11:35:54.579: Runtime error

module ‘facebook’ not found:

no field package.preload[‘facebook’]

With (my installed) previous build 2015.2731 the same code works fine!

Something is changed?

This my environment (Mac OS)

Platform: KFTT / x86_64 / 10.10.5 / NVIDIA GeForce GT 650M OpenGL Engine / 2.1 NVIDIA-10.4.2 310.41.35f01 / 2015.274

 

Thank you 

Simone

I think facebook is a pre-activated plugin, but you might confirm it is activated on your store page:

https://store.coronalabs.com/plugins?field_primary_category_tid=All&sort_by=title&sort_order=ASC&items_per_page=All

This is probably not it, but I’d check just in case.

I’m actually having that same issue. I reverted back to 2731 to continue building.

It’s Pre-Activated

Hi,

also the last version of Build (2750) crashes with same error:

Runtime error
module ‘facebook’ not found:
no field package.preload[‘facebook’]

 

What happens? I just change some configurations?

 

Thank you

I’m having the same problem as well :frowning:

I’ll check with Engineering. Please use 2731 for now.

Rob

Also are you using the older Facebook plugin or the Facebook V4 plugin?

I’m apparently using the older one. I didn’t realize there was a V4 version until I saw it a few days ago.

When you browse the SDK you are brought to the “old” one, so this is perhaps a bit misleading with the documentation: https://docs.coronalabs.com/daily/api/library/facebook/index.html

The older Facebook plugin

Please move to the V4 plugin.

iOS: https://coronalabs.com/blog/2015/09/01/facebook-v4-plugin-ios-beta-improvements-and-new-features/

Android: https://coronalabs.com/blog/2015/07/24/facebook-v4-plugin-android-beta/

The old plugin will still work on the device, but the stub plugin we use for the simulators was removed in build 2747. While we still have the “beta” label on the plugin, it’s still stable to use for any use you were using the older plugin for.

Rob

I migrate to new plugin and activated Facebook v4 plugin but there is a runtime error:

module ‘plugin_facebook_v4’ not found:
no field package.preload[‘plugin_facebook_v4’]
no file ‘/Users/my_mac_user/Library/Application Support/Corona/Simulator/Plugins/plugin_facebook_v4.lua’
no file ‘/Users/my_mac_user/Project/corona/StevePunk/plugin_facebook_v4.lua’
no file ‘/Applications/CoronaSDK-2751/Corona Simulator.app/Contents/Resources/plugin_facebook_v4.lua’
no file ‘/Users/my_mac_user/Library/Application Support/Corona/Simulator/Plugins/plugin_facebook_v4.dylib’
no file ‘./plugin_facebook_v4.dylib’
no file ‘/Applications/CoronaSDK-2751/Corona Simulator.app/Contents/Resources/plugin_facebook_v4.dylib’

 

It seems miss plugin file? How to get this file? I try to dehautorized and re-authorized my profile and download the last build, but does not works.

 

Pleas help me

 

Simone

If build for Android it works…

This plugin is not available on Simulator? 

Can you post your build.settings?

Thanks, Rob

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "portrait", content = "portrait", supported = { "portrait", "portraitUpsideDown" } }, excludeFiles = { iphone = { "Icon-\*dpi.png" }, android = { "Icon-120.png", "Icon-152.png", "Icon-16.png", "Icon-24.png", "Icon-32.png", "Icon-40.png", "Icon-40@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-64.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Amazon.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon.png", "Icon@2x.png", }, }, plugins = { ["plugin.facebook.v4"] = { supportedPlatforms={iphone=true, android=true, osx=false, win32=false}, publisherId="com.coronalabs" }, ["plugin.google.play.services"] = { supportedPlatforms={iphone=true, android=true, osx=false, win32=false}, publisherId="com.coronalabs" }, ["plugin.google.iap.v3"] = { supportedPlatforms={iphone=true, android=true, osx=false, win32=false}, publisherId="com.coronalabs" }, ["CoronaProvider.ads.vungle"] = { supportedPlatforms={iphone=true, android=true, osx=false, win32=false}, publisherId="com.vungle" }, }, iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, UIApplicationExitsOnSuspend = false, UIAppFonts = { "nightclub-btn.ttf" }, CFBundleIconFiles = { "Icon-120.png", "Icon-152.png", "Icon-16.png", "Icon-24.png", "Icon-32.png", "Icon-40.png", "Icon-60.png", "Icon-64.png", "Icon-72.png", "Icon-76.png", "Icon-40@2x.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72@2x.png", "Icon-76@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon.png", "Icon@2x.png", }, FacebookAppID = "XXXXXXXXX", CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXX", } } }, -- Whitelist Facebook Servers for Network Requests NSAppTransportSecurity = { NSExceptionDomains = { ["fbcdn.net"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, ["facebook.com"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, ["akamaihd.net"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, }, }, -- Whitelist Facebook Apps LSApplicationQueriesSchemes = { "fb", "fbapi20130214", "fbapi20130410", "fbapi20140410", "fbapi20140116", "fbapi20150313", "fbapi20150629", "fbauth", "fbauth2", "fb-messenger-api20140430", }, }, }, android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "com.android.vending.BILLING", "com.android.vending.CHECK\_LICENSE", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, facebookAppId = "XXXX", } }

But this file is also used when open Simulator?

You can’t use Facebook in the simulator. Facebook doesn’t make an SDK for that. On OS-X and Windows they expect people to be making Javascript calls to their REST API.

But you shouldn’t get an error. I know sometimes it takes a little while for plugins to become avaialble, but most of the time it’s an issue with build.settings. It’s odd though that it works on Android but not iOS.

Rob

As of build 2753 I’m still getting that same issue, even though its Facebook V4.

Module 'facebook' not found: no field package.preload['facebook'] no file '/Users/User/Library/Application Support/Corona/Simulator/Plugins/facebook.lua' no file '/Users/User/Desktop/Clients/Game - Public Alpha/Game/src/facebook.lua' no file '/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/facebook.lua' no file '/Users/User/Library/Application Support/Corona/Simulator/Plugins/facebook.dylib' no file './facebook.dylib' no file '/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/facebook.dylib' File: module 'facebook' not found

Here are my build settings based on the Corona SDK documentation for V4:

-- -- For more information on build.settings see the Corona SDK Build Guide at: -- http://docs.coronalabs.com/guide/distribution/buildSettings/index.html -- -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "landscapeRight", supported = { "landscapeRight", "landscapeLeft" }, }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, iphone = { plist = { UIAppFonts = { "font.ttf" }, CFBundleDisplayName = "Game", CFBundleName = "Spirdy", CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, --required CFBundleURLTypes = { { CFBundleURLSchemes = { "XXXXXXXXXXXXXXX", } } --replace XXXXXXXXXX with your Facebook App ID }, UILaunchImages = {}, --required UIApplicationExitsOnSuspend = false, UIPrerenderedIcon = true, UIStatusBarHidden = true, MinimumOSVersion = "6.0", FacebookAppID = "XXXXXXXXXXXXX", NSAppTransportSecurity = { NSExceptionDomains = { ["fbcdn.net"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, ["facebook.com"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, ["akamaihd.net"] = { NSIncludesSubdomains = true, NSExceptionRequiresForwardSecrecy = false, }, }, }, -- Whitelist Facebook Apps LSApplicationQueriesSchemes = { "fb", "fbapi20130214", "fbapi20130410", "fbapi20140410", "fbapi20140116", "fbapi20150313", "fbapi20150629", "fbauth", "fbauth2", "fb-messenger-api20140430", }, }, }, -- Android permissions android = { FacebookAppID = "XXXXXXXXXXX", googlePlayGamesAppId = XXXXXXXXX, usesExpansionFile = true, minSdkVersion = "14", largeHeap = true, usesPermissions = { "android.permission.VIBRATE", "android.permission.INTERNET", "com.android.vending.CHECK\_LICENSE", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, }, plugins = { --key is the name passed to the Lua "require()" ["CoronaProvider.gameNetwork.google"] = { --required! publisherId = "com.coronalabs", supportedPlatforms = { android = true }, }, ["plugin.facebook.v4"] = { publisherId = "com.coronalabs" }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs" }, }, }

The build.settings work using build 5731. Anything above that doesn’t. The error above is what I am getting just from having the local facebook = require(“facebook”) in my main.lua. I’m not calling any Facebook functions, just the module.  

@orphinsoftwaresllc:

  • In your build.settings, in the CFBundleURLSchemes table, be sure you prefix the Facebook App Id with “fb”
  • You’ll also need to change your require statements from require(“facebook”) to require(“plugin.facebook.v4”)

@Simone Valenti: Have you activated the Facebook-v4 plugin in the Plugin Store? https://store.coronalabs.com/plugin/facebook-v4

Thanks sir! I just needed to change the module string in my require function.