2014.2511 broke facebook implementation

after updating corona sdk from 2014.2393 to 2014.2511 app displays an error () when the scene with facebook implementation loads. everything worked fine until i rebuilt it with latest corona sdk. just want someone to tell me what they changed so i can fix this quickly please, thank you!

Hi @kbrockertii,

Facebook is now a plugin, so you need to “require()” it slightly differently than before, and include the plugin in your “build.settings” file. Otherwise, functionality should be the same. Here is the updated documentation:

http://docs.coronalabs.com/plugin/facebook/index.html

Take care,

Brent

ok i see the difference. took me a minute to notice the “plugin.” part. i also refer to this page a lot and it should be updated.

http://docs.coronalabs.com/guide/social/implementFacebook/index.html

it still shows the require line without “plugin.”

Hi @kbrockertii,

You’re right, and thanks for the note… I’ll update that guide soon.

Brent 

i feel like im still overlooking something. now i get the same error but instead of facebook.lu missing its plugin.facebook.lu

would using JDK 8 have anything to do with it? i realised that i also updated my JRE and the JDK to java 8 recently

EDIT: i tried reverting jdk it did nothing

I still need help. I’m trying to release the game before Christmas and it was working flawlessly before I updated corona

Hi @kbrockertii,

Please use JDK 6 as instructed in the docs, and make sure that you completely reverted and un-installed all traces of JDK 8.

http://docs.coronalabs.com/guide/distribution/androidBuild/index.html

As for your Facebook issue, can I see your entire “build.settings” file content? And also the code where you require() the plugin? Please surround everything with “lua” tags so we can read it more clearly.

[lua] ... [/lua]

Thanks,

Brent

already made sure there were no traces of JDK 8. I’ve been using JDK 7 since before i installed and started using Corona SDK so i doubt that has anything to do with it.

[lua]

– Supported values for orientation:
– portrait, portraitUpsideDown, landscapeLeft, landscapeRight

settings = {

    android =
    {
        googlePlayGamesAppId = “XXXXXXXXX”, – Your Google Play Games App Id
    },
    plugins = {
        [“facebook”] =
        {
            publisherId = “com.coronalabs”,
            supportedPlatforms = { iphone=true, [“iphone-sim”]=true },
        },
        --[“CoronaProvider.ads.admob”] = {
            --publisherId = “com.coronalabs”,
        --},
        [“plugin.google.play.services”] =
        {
            publisherId = “com.coronalabs”
        },
        [“CoronaProvider.gameNetwork.google”] =
        {
            publisherId = “com.coronalabs”,
            supportedPlatforms = { android = true }
        },
    },

    orientation = {
        default = “portrait”,
        supported = { “portrait”, }
    },
    
    iphone = {
        plist = {
            UIStatusBarHidden = false,
            UIPrerenderedIcon = true, – set to false for “shine” overlay
            UIApplicationExitsOnSuspend = false, – set explicitly for FB
            FacebookAppID = “XXXXXXXXXXXX”,

            – iOS app URL schemes:
            CFBundleURLTypes =
            {
                CFBundleURLSchemes =
                {
                “fbXXXXXXXXXXXX”, – scheme for facebook
                }
            },
            
            CFBundleIconFiles = {
                “Icon.png”,
                “Icon@2x.png”,
                “Icon@3x.png”,
                “Icon-Small.png”,
                “Icon-Small@2x.png”,
                “Icon-Small-40.png”,
                “Icon-Small-40@2x.png”,
                “Icon-Small-50.png”,
                “Icon-Small-50@2x.png”,
            }
        }
    },
    – Android permissions

    androidPermissions = {
        “android.permission.INTERNET”,
        “android.permission.WRITE_EXTERNAL_STORAGE”,
        “android.permission.ACCESS_WIFI_STATE”,
        “android.permission.ACCESS_NETWORK_STATE”,
        “android.permission.VIBRATE”
    },

    excludeFiles =
        {
            – Exclude all Android icon files and .ogg files in the “music” directory:
            iphone = { “Icon-*dpi.png”, “music/*.ogg” },
            – Exclude iOS “retina” image files and .m4a files in the “music” directory:
            android = { “Icon.png”, “*@2x.png”, “Icon-Small*”, “music/*.m4a” }
        },
}

[/lua]

[lua]

local composer = require( “composer” )

local scene = composer.newScene()
composer.recycleOnSceneChange = true

local facebook = require( “plugin.facebook” )
local gameNetwork = require( “gameNetwork” )
local GGTwitter = require( “GGTwitter” )
local json = require( “json” )

local gameStates = require(“gameStates”)

local phcImagesInfo = require “phcImages”
local phcImagesSheet = graphics.newImageSheet( “images/phcImages.png”, phcImagesInfo:getSheet())

local phcImagesInfo2 = require “phcImages2”
local phcImagesSheet2 = graphics.newImageSheet( “images/phcImages2.png”, phcImagesInfo2:getSheet())


– All code outside of the listener functions will only be executed ONCE unless “composer.removeScene()” is called.


– local forward references should go here
local menuSelectSound = audio.loadSound(“sounds/menuSelect.mp3” )

local screenW, screenH, halfW = display.pixelWidth, display.pixelHeight, display.pixelWidth*0.5

local function doesFileExist( fname, path )
    local results = false

    local filePath = system.pathForFile( fname, path )

    --filePath will be ‘nil’ if file doesn’t exist and the path is ‘system.ResourceDirectory’
    if ( filePath ) then
        filePath = io.open( filePath, “r” )
    end
    
    if ( filePath ) then
        print( "File found: " … fname )
        --clean up file handles
        filePath:close()
        results = true
    else
        print( "File does not exist: " … fname )
    end
    
    return results
end

– facebook
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 ) )

    --“session” events cover various login/logout events
    --“request” events handle calls to various Graph API calls
    --“dialog” events are standard popup boxes that can be displayed

    if ( “session” == event.type ) then
        --options are: “login”, “loginFailed”, “loginCancelled”, or “logout”
        if ( “login” == event.phase ) then
            local access_token = event.token
            --code for tasks following a successful login
            print(“facebook auth”)
            gameStates:setFbActive(true)
            local alert = native.showAlert(“Ok, ready”, “Press the Facebook Button Again to Post to the Leader Board.”, {“Got it”})
        elseif ( “logout” == event.phase ) then
            print(“facebook de-auth”)
            gameStates:setFbActive(false)
        end

    elseif ( “request” == event.type ) then
        print(“facebook request”)
            if ( not event.isError ) then
                local response = json.decode( event.response )
                print(response)
                --process response data here
            end

    elseif ( “dialog” == event.type ) then
        print( “dialog”, event.response )
        --handle dialog results here
    end
end

[/lua]

[lua]

    local function fBookBtnTap(event)
        if gameStates.getSoundOn() == true then
            audio.play(menuSelectSound)
        end
        if gameStates.getFbActive() == false then
            local fbAppID = “XXXXXXXXXXXXXX”
            facebook.login( fbAppID, facebookListener, { “public_profile”, “publish_actions”, “user_friends”, “user_games_activity”, “friends_games_activity” } )
        else
            facebook.request( “me/scores”, “POST”, { score = savedData } )
            print(“facebook post”)
            local alert = native.showAlert( “Score Posted”, “Your high-score has been posted to Facebook.”, {“OK”})
        end

        return true
    end

[/lua]

i left some code out hopefully u dont need any of it

EDIT: i turned my ids into Xs

EDIT; i should mention i tried leaving out line 12 on build.settings

Hi @kbrockertii,

You’re testing this on Android, but you’ve told the plugin to restrict itself to iOS by specifying the “supportedPlatforms” table. That is the reason it can’t load the plugin.

Brent

as i said before, it worked before the update and i tried removing that line and it doesn’t help. the documentation told me those lines had to be there or i wouldn’t even have them.

im going to try and remove line 12 again maybe i forgot to save.

[lua]

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

[/lua]

and install only java 6 sdk. BTW thanks for your help!

EDIT: i see now i hadnt commited the changes, explaining why the line was still there in the version i submitted.

If you want to run on Android, then you need to remove the supportedPlatforms line.

However the 2nd error is line 4 of your main.lua.  it should be:

local facebook = require( “facebook” )

Rob

same deal plugin.facebook not found. should i tell to to explicitly support android rather than removing the line?

well thats what i had in the beginning. i changed it according to this page… http://forums.coronalabs.com/topic/53240-20142511-broke-facebook-implementation/?p=276689

ok wow just opened my working copy of build.settings and my 2nd edit didn’t take effect so im building it again…

removing the line supportedPlatforms = { iphone=true, [“iphone-sim”]=true }, for the third time…

Don’t forget that our Sample Apps are great examples of how to do things.

Rob

ok u guys were both sending me the right information but this page had me change the require line to “plugin.facebook”.

whats strange is i noticed a long time ago that the line “supportedPlatforms = { iphone=true, [“iphone-sim”]=true }” hadn’t made any sense but this page had me add it to support iOS and it worked on android just fine…

anyway thank you both the problem was resolved. all i had to do in the beginning was remove that line from build.settings

Hi @kbrockertii,

Yes, sorry about that, I’m correcting that citation, and also the guide right now. Changes should go into effect soon.

Brent

:’( the iOS build just crashes now and there’s no error. id wager there’s another plugin i need to implement differently. game network probably?