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

I moved the Scrumptious code to the SimpleLuaExtension App for testing it in Xcode.

Like everyone I am too facing problem with facebook login. I have done everything that is required to make it work and I get following error.

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

Am using :

Xcode   : Version 5.1 (5B130a)

Corona  : Version 2014.2411 (2014.8.22)

OS X     : Version 10.8.5

Here is my main.lua

local facebook = require( "facebook" ) local json = require( "json" ) local fbAppID = "xxxxxxxxxxxxxxx" -- Just checking if facebook popup is available ( shows false on screen ) isFacebookAvailable = native.canShowPopup( "social", "facebook" ) display.newText( tostring(isFacebookAvailable), 50, 200, "Arial", 15 ) local function facebookListener( event )     if ( "session" == event.type ) then         if ( "login" == event.phase ) then             local access\_token = event.token         end     elseif ( "request" == event.type ) then         display.newText( "facebook request", 50, 300, "Arial", 15 )         if ( not event.isError ) then             local response = json.decode( event.response )             display.newText( response, 50, 350, "Arial", 15 )         end     elseif ( "dialog" == event.type ) then         display.newText( "dialog"..event.response, 50, 400, "Arial", 15 )     end end facebook.login( fbAppID, facebookListener, { "publish\_actions, email" } )

Here is my build.settings file

settings = { plugins = {         ["facebook"] =         {             publisherId = "com.coronalabs",             supportedPlatforms = { iphone=true, ["iphone-sim"]=true },         }, }, iphone = {         plist = {             UIApplicationExitsOnSuspend = false,             FacebookAppID = "xxxxxxxxxxxxxxx",             CFBundleURLTypes = {                 {                 CFBundleURLSchemes = { "fbxxxxxxxxxxxxxxx", }                 }             },             ["URL types"] = {                 item = {                     ["URL Schemes"] =                         { ["Item 0"] = "fbxxxxxxxxxxxxxx" },                 },             },         }     } }

and Here is my console log

2014-09-03 14:44:07.197 SimpleLuaExtension[5074:90b] Platform: iPhone Simulator / x86\_64 / 7.1 / Apple Software Renderer / OpenGL ES 2.0 APPLE-9.4.3 2014-09-03 14:44:07.243 SimpleLuaExtension[5074:90b] Runtime error module 'facebook' not found:resource (facebook.lu) does not exist in archive no field package.preload['facebook'] no file '/Users/akash/Library/Application Support/iPhone Simulator/7.1/Applications/FB70555B-4BB5-4585-B845-EFBA70E13F0C/SimpleLuaExtension.app/facebook.lua' no file '/Users/akash/Library/Application Support/iPhone Simulator/7.1/Applications/FB70555B-4BB5-4585-B845-EFBA70E13F0C/SimpleLuaExtension.app/facebook.lua' no file './facebook.so' no file '/Users/akash/Library/Application Support/iPhone Simulator/7.1/Applications/FB70555B-4BB5-4585-B845-EFBA70E13F0C/SimpleLuaExtension.app/facebook.so'facebook stack traceback: [C]: in function 'require' ?: in function 'require' /Applications/CoronaEnterprise/Samples/SimpleLuaExtension/ios/../Corona/main.lua:1: in main chunk

The error is caused by 

local facebook = require( “facebook” )

if I remove it then I get this error

2014-09-03 15:09:52.848 SimpleLuaExtension[5313:90b] Platform: iPhone Simulator / x86\_64 / 7.1 / Apple Software Renderer / OpenGL ES 2.0 APPLE-9.4.3 2014-09-03 15:09:53.210 SimpleLuaExtension[5313:90b] Runtime error /Applications/CoronaEnterprise/Samples/SimpleLuaExtension/ios/../Corona/main.lua:38: attempt to index global 'loginfb' (a nil value) stack traceback: /Applications/CoronaEnterprise/Samples/SimpleLuaExtension/ios/../Corona/main.lua:38: in main chunk

The error is same for iPhone simulator “iPhone Retina (4-inch)” (a non 64-bit, as suggested by corona staff) and also for iPhone device.

I believe someone will be able to solve this much information. Let me know if you need something from me.

Have you installed the facebook plugin library?

Rob

Hi Rob,

Do I need to insert some external facebook.lua file in my project?

Plugins work differently for Enterprise users.  Since you are trying to build with Enterprise, the build.settings doesn’t get used.  All of that comes from your Xcode project settings.  Plugins for Enterprise are not downloaded from our servers like they are for SDK users.  If you go to the Enterprise download page, there will be a file called something like:  CoronaEnterprisePlugins.2014.2421.tgz

The last four digits will change depending on the build of Corona Enterprise you using.  Download the one that matches your build, to a:

tar -xvfz CoronaEnterprisePlugins.2014.2421.tgz

to unpack the tarball and you should find all of the plugins in there.  You will need to move the facebook plugin into your Xcode project.  Now I’m not very knowledgeable about the exact steps to do that.  There should be documentation on the Enterprise docs that covers installing these object libraries.

Rob

Hi Rob, thanks for helping me out, I found the plugin folder.

As you said before this is a xcode plugin, do I need to include “facebook ios sdk” too for login or this will help corona’s own facebook.* library to login?

Is it possible to login to facebook only using corona enterprise version without using xcode at all?

What I am guessing is that I have to include this facebook library into xcode and corona will automatically use it for its own facebook.* services. Is it correct?

Hi Rob, thanks for all your help, I was able to login with facebook, but it opens a popup for login, and as per new Apple guidelines, you should not redirect user outside your app( for example safari for login ). Is there any way to use the credentials a user has saved in his iPhone settings, because if we will use your facebook library then the app will be rejected immediately.

What will you suggest in this case?

Can you point me to these guidelines?  Is there proof Apple will reject apps?  Because this is how Facebook logins happen when using their APIs.  The share plugin uses the iOS information, but as far as I know to use the Facebook SDK you have to launch their app and answer their dialogs.  If you were using Corona SDK this would involve somethings in your build.settings file.  With Enterprise, you have to put them in your plist.  There is a FacebookAppId and a URL schema set.

As an Enterprise subscriber, you can download and run Corona SDK as it’s own product.  This is the way to use Corona without Xcode, You could build your product using Corona SDK.  The “Enteprise” part requires Xcode to build.

Rob

I don’t know if the guideline is updated till now online or not but the reason for rejection my iOS team got from Apple was this:

Google+ log-in opens a web page in mobile Safari for logging in, then returns the user to the app. The user should be able log in without opening Safari first.

Wont it be a good idea if corona accepts credentials from iPhone settings? This way login chances will be 100%.

I’m not familiar with the G+ API.  For Facebook, it’s designed to launch the native Facebook App first, and then fall back to Safari if it can’t login.  I wonder why Apple is punting apps for this.  Not everyone service can support an in-app direct login.

Have you installed the facebook plugin library?

Rob

Hi Rob,

Do I need to insert some external facebook.lua file in my project?

Plugins work differently for Enterprise users.  Since you are trying to build with Enterprise, the build.settings doesn’t get used.  All of that comes from your Xcode project settings.  Plugins for Enterprise are not downloaded from our servers like they are for SDK users.  If you go to the Enterprise download page, there will be a file called something like:  CoronaEnterprisePlugins.2014.2421.tgz

The last four digits will change depending on the build of Corona Enterprise you using.  Download the one that matches your build, to a:

tar -xvfz CoronaEnterprisePlugins.2014.2421.tgz

to unpack the tarball and you should find all of the plugins in there.  You will need to move the facebook plugin into your Xcode project.  Now I’m not very knowledgeable about the exact steps to do that.  There should be documentation on the Enterprise docs that covers installing these object libraries.

Rob

Hi Rob, thanks for helping me out, I found the plugin folder.

As you said before this is a xcode plugin, do I need to include “facebook ios sdk” too for login or this will help corona’s own facebook.* library to login?

Is it possible to login to facebook only using corona enterprise version without using xcode at all?

What I am guessing is that I have to include this facebook library into xcode and corona will automatically use it for its own facebook.* services. Is it correct?

Hi Rob, thanks for all your help, I was able to login with facebook, but it opens a popup for login, and as per new Apple guidelines, you should not redirect user outside your app( for example safari for login ). Is there any way to use the credentials a user has saved in his iPhone settings, because if we will use your facebook library then the app will be rejected immediately.

What will you suggest in this case?

Can you point me to these guidelines?  Is there proof Apple will reject apps?  Because this is how Facebook logins happen when using their APIs.  The share plugin uses the iOS information, but as far as I know to use the Facebook SDK you have to launch their app and answer their dialogs.  If you were using Corona SDK this would involve somethings in your build.settings file.  With Enterprise, you have to put them in your plist.  There is a FacebookAppId and a URL schema set.

As an Enterprise subscriber, you can download and run Corona SDK as it’s own product.  This is the way to use Corona without Xcode, You could build your product using Corona SDK.  The “Enteprise” part requires Xcode to build.

Rob

I don’t know if the guideline is updated till now online or not but the reason for rejection my iOS team got from Apple was this:

Google+ log-in opens a web page in mobile Safari for logging in, then returns the user to the app. The user should be able log in without opening Safari first.

Wont it be a good idea if corona accepts credentials from iPhone settings? This way login chances will be 100%.

I’m not familiar with the G+ API.  For Facebook, it’s designed to launch the native Facebook App first, and then fall back to Safari if it can’t login.  I wonder why Apple is punting apps for this.  Not everyone service can support an in-app direct login.