What is very strange is that the above code doesn’t even fire the fblistener function when building with the latest build, but when using 894, it goes to Facebook but doesn’t post.
Any thoughts on why this might be happening?
What is very strange is that the above code doesn’t even fire the fblistener function when building with the latest build, but when using 894, it goes to Facebook but doesn’t post.
Any thoughts on why this might be happening?
Hi Rob – I’m getting the same issue as rhmueed. I’m using apprequests, but same sort of problem. It appears as though the app has gone through the cycle of submitting the app request, but nothing appears to the facebook user.
Here are my console errors:
Apr 30 15:26:28 Stephens-iPhone backboardd[26] <Warning>: Facebook[3423]: Could not stat /private/var/mobile/Applications/088DEEEE-3BEB-48AB-B3F3-CCD49FE61B2C/tmp/etilqs_Dy5MKPYxfUPrWeI: No such file or directory
Apr 30 15:26:28 Stephens-iPhone backboardd[26] <Warning>: Facebook[3423]: Could not stat /private/var/mobile/Applications/088DEEEE-3BEB-48AB-B3F3-CCD49FE61B2C/tmp/etilqs_QjYvWQkXulgNZ0I: No such file or directory
Apr 30 15:26:28 Stephens-iPhone backboardd[26] <Warning>: Facebook[3423]: Could not stat /private/var/mobile/Applications/088DEEEE-3BEB-48AB-B3F3-CCD49FE61B2C/tmp/etilqs_Zg52FE56gxUppKZ: No such file or directory
Apr 30 15:26:28 Stephens-iPhone backboardd[26] <Warning>: Facebook[3423]: Could not stat /private/var/mobile/Applications/088DEEEE-3BEB-48AB-B3F3-CCD49FE61B2C/tmp/etilqs_hFjyENMrlmo6Hmb: No such file or directory
Yeah same issue here, app goes through the motions to post, but nothing gets posted. Please test this.
I am getting the same issue, where it takes me to Facebook to post, but does not post. This is using build 2012.894. When trying to post with build 2012.1076, it doesn’t even go to Facebook.
Here is the Facebook controller code, whose externally facing functions (at the bottom) are called by any function needing Facebook functionality. The Facebook configuration on FB’s side configuration is exactly the same as Rob Miracle’s above.
[lua]
module(…, package.seeall)
facebookControllerInstance = nil
function facebook_controller:getFacebookControllerInstance()
if facebookControllerInstance then
return facebookControllerInstance
end
local facebook = require “facebook”
require “facebook_meta”
facebookControllerInstance = {}
local JSON = require(“JSON”)
local appId = facebook_meta[“appID”]
local apiKey = facebook_meta[“apiKey”]
local appLink
local deviceOS = system.getInfo(“platformName”)
if deviceOS == “iPhone OS” then
appLink = facebook_meta[“iOS”]
else
appLink = facebook_meta[“Android”]
end
local fbCommand
local POST_MSG = 1
local GET_USER_INFO = 2
local postLevelAch = true
local postMainAch = false
local postAmmoAch = false
local achInfo = {}
local wallData, userData
local function getMessageInfo()
if postLevelAch then
wallData.caption = userData.name … facebook_meta[“level_part1”] … achInfo.score … facebook_meta[“level_part2”] … achInfo.level … facebook_meta[“level_part3”]
wallData.picture = facebook_meta[“achievement_image”]
elseif postMainAch then
wallData.caption = userData.name … facebook_meta[“achievement_part1”] … achInfo.giftName … facebook_meta[“achievement_part2”]
wallData.picture = facebook_meta[“achievement_image”]
elseif postAmmoAch then
wallData.caption = userData.name … " won an " … achInfo.giftName … facebook_meta[“level_part3”]
wallData.picture = facebook_meta[“achievement_image”]
else
wallData.caption = userData.name … facebook_meta[“chapter_part1”] … achInfo.chapter … facebook_meta[“chapter_part2”]
wallData.picture = facebook_meta[“achievement_image”]
end
end
local function fbListener( event )
if event.type == “session” then
if event.phase == “login” then
if fbCommand == POST_MSG then
getMessageInfo()
facebook.request(“me/feed”, “POST”, wallData)
native.showAlert(“Achievement Shared!”, “Your achievement has been successfully posted to Facebook!”, {“OK”})
elseif fbCommand == GET_USER_INFO then
facebook.request(“me”)
end
end
elseif event.type == “request” then
if event.isError then return end
local response = event.response
if fbCommand == GET_USER_INFO then
userData = JSON:decode(response)
getMessageInfo()
fbCommand = POST_MSG
facebook.login(appId, fbListener, {“publish_stream”})
end
end
end
local function callWallPost()
wallData = {
name = facebook_meta[“app_name”],
link = appLink,
actions = JSON:encode({name = facebook_meta[“app_name”], link = appLink})
}
if userData then
fbCommand = POST_MSG
else
fbCommand = GET_USER_INFO
end
facebook.login(appId, fbListener, {“publish_stream”})
end
facebookControllerInstance.postLevelAchievement = function(self, level, score)
achInfo.level = level
achInfo.score = score
callWallPost()
end
facebookControllerInstance.postMainAchievement = function(self, giftName, giftImage)
postLevelAch = false
postMainAch = true
achInfo.giftName = giftName
achInfo.giftImage = giftImage
callWallPost()
end
facebookControllerInstance.postAmmoAchievement = function(self)
postLevelAch = false
postAmmoAch = true
achInfo.giftName = “an ammo pack”
achInfo.giftImage = “ui_ammo_icon”
callWallPost()
end
facebookControllerInstance.postChapterAchievement = function(self, chapter)
postLevelAch = false
achInfo.chapter = chapter
callWallPost()
end
return facebookControllerInstance
end
[/lua]
And here is build.settings
[lua]
settings =
{
androidPermissions =
{
“android.permission.VIBRATE”,
“android.permission.INTERNET”,
“com.android.vending.BILLING”,
“android.permission.READ_PHONE_STATE”,
“android.permission.ACCESS_NETWORK_STATE”,
“android.permission.ACCESS_WIFI_STATE”
},
orientation =
{
default = “landscapeRight”,
supported =
{
“landscapeRight”,
},
},
iphone =
{
plist=
{
UIApplicationExitsOnSuspend = false,
UIStatusBarHidden=true,
UIPrerenderedIcon = true,
FacebookAppID = “XXXXXXXXXXXX” [ID stripped from this forum for security]
CFBundleIdentifier = “something.something.something” [ID stripped from this forum for security]
CFBundleDisplayName = “App Name” [ID stripped from this forum for security]
CFBundleURLTypes =
{
{
CFBundleURLSchemes =
{
“fbXXXXXXXXXXXXX”, [ID stripped from this forum for security]
CFBundleIconFile = “Icon.png”,
}
}
},
CFBundleIconFiles = {
“Icon.png” ,
“Icon@2x.png” ,
“Icon-72.png” ,
},
UIAppFonts =
{
[fonts used — stripped from this forum post]
},
},
components = {}
}
}
[/lua]
That’s quite a bit of complex code to look at. But I have to ask a very dumb question. Are you expecting to use our built in JSON library or are you providing your own? The require(“JSON”) is looking for an upper case JSON entry which in the sim doesn’t matter, but it could thrown an error on a device since we are using lower case “json”.
Also why are you logging in multiple times? You login, get a ‘me’ object and then in handling the return of the “me” object, you login again? You should login once, and then do facebook.requests()'s to fetch further data, unless I missed a logout in there somewhere.
Rob good tips. I have removed double login, and switched the json library from the custom library (yes we were using a custom library) that was being used to the one corona has built in.
Sorry for just throwing a bunch of messy spaghetti code into your part of the internet, I know it’s a little tough to read.
The core part that’s making me bang my head against the wall is this part:
[lua]facebook.login(appId, fbListener, {“publish_actions”})[/lua]
Last night I wrote a little bit of dummy code (using the AppID of my existing Facebook app) to test facebook login inside my main.lua main() function which is show below.
[lua]
local facebook = require “facebook”
local json = require “json”
local function fbListener(event)
local wallData
wallData = {
name = “my game name”,
link = “[my app link]”,
actions = json.encode({name = “my game name”, link = “[my app link]”})
}
if ( “session” == event.type ) then
– upon successful login, request list of friends of the signed in user
if ( “login” == event.phase ) then
facebook.request( “me/friends”, “POST”, wallData )
end
end
end
facebook.login("[my existing Facebook app ID]", fbListener, {“publish_actions”})
[/lua]
With corona 2012.894 it fetches permissions, but then hangs with a blank login window when it gets to Facebook (looks like the below)
With 2013.1076 it doesn’t even try to login at all.
Any ideas on why this might be happening or what i could do to debug?
What is very strange is that the above code doesn’t even fire the fblistener function when building with the latest build, but when using 894, it goes to Facebook but doesn’t post.
Any thoughts on why this might be happening?
This same thing is happening in my app, that you have posted in the image above. I am only trying to login a Corona cloud user, not to post anything. Did you resolve this issue? All my Facebook code works fine with my android build, but I am having a big problem trying to get it to work iOS build.
Best Regards
Gooner87
Hello Rob,
Any updates on Corona Facebook integration. I have tried different things but still no success. As you can see other guys are having the common issue. Any help !!
Hi all,
Out of curiosity, in your settings for your app on Facebook, do you have Sandbox Mode enabled? (It’s under Settings, Basic, Basic Info.) If you do, have you listed yourself as a Developer (not just an Administrator, but a Developer) under Developer Roles? I think if you have Sandbox Mode enabled and you aren’t listed as a developer, you may get a blank login screen like you’re seeing. You could try either adding yourself as a Developer, or disabling Sandbox Mode entirely, and seeing if that makes a difference.
You should also run our sample app against your facebook ID and make sure you don’t have a facebook setup error
This same thing is happening in my app, that you have posted in the image above. I am only trying to login a Corona cloud user, not to post anything. Did you resolve this issue? All my Facebook code works fine with my android build, but I am having a big problem trying to get it to work iOS build.
Best Regards
Gooner87
Hello Rob,
Any updates on Corona Facebook integration. I have tried different things but still no success. As you can see other guys are having the common issue. Any help !!
Hi all,
Out of curiosity, in your settings for your app on Facebook, do you have Sandbox Mode enabled? (It’s under Settings, Basic, Basic Info.) If you do, have you listed yourself as a Developer (not just an Administrator, but a Developer) under Developer Roles? I think if you have Sandbox Mode enabled and you aren’t listed as a developer, you may get a blank login screen like you’re seeing. You could try either adding yourself as a Developer, or disabling Sandbox Mode entirely, and seeing if that makes a difference.
You should also run our sample app against your facebook ID and make sure you don’t have a facebook setup error
Same issue here. Facebook was working in the previous daily build (700-ish) but when I upgraded to build 1134, facebook.login doesn’t work anymore. Any ideas? I’ve tried using my appId in the Corona Facebook sample app and got the error below from the console:
Jun 6 20:48:58 Ericks-iPhone-5 Facebook[19929] <Warning>: Generic error
com.facebook.sdk:InvalidOperationException: 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
(
0 CoreFoundation 0x315bc3ff <redacted> + 186
1 libobjc.A.dylib 0x392b7963 objc_exception_throw + 30
2 CoreFoundation 0x315bc0d5 <redacted> + 0
3 Facebook 0x000a97cd start + 50453
4 Facebook 0x000ace11 start + 64345
5 Facebook 0x000aa42f start + 53623
6 Facebook 0x00188cb1 _ZNK6Corona12IOSFBConnect5LoginEPKcPS2_i + 364
7 Facebook 0x0018a53d _ZN6Corona15FacebookLibrary5loginEP9lua_State + 188
8 Facebook 0x0011a071 CoronaPushNativeObject + 172204
9 Facebook 0x00126ba1 CoronaPushNativeObject + 224220
10 Facebook 0x0011a25f CoronaPushNativeObject + 172698
11 Facebook 0x00113c2d CoronaPushNativeObject + 146536
12 Facebook 0x0012796f CoronaPushNativeObject + 227754
13 Facebook 0x0011a493 CoronaPushNativeObject + 173262
14 Facebook 0x00113c05 CoronaPushNativeObject + 146496
15 Facebook 0x0013d55b CoronaPushNativeObject + 316822
16 Facebook 0x00133557 CoronaPushNativeObject + 275858
17 Facebook 0x00136bb7 CoronaPushNativeObject + 289778
18 Facebook 0x00136fe5 CoronaPushNativeObject + 290848
19 Facebook 0x00136cbb CoronaPushNativeObject + 290038
20 Facebook 0x00136f87 CoronaPushNativeObject + 290754
21 Facebook 0x00152a65 CoronaPushNativeObject + 404128
22 Facebook 0x000d367f start + 222151
23 UIKit 0x3350c9ff <redacted> + 234
24 UIKit 0x3350c9ff <redacted> + 234
25 UIKit 0x333de5f9 <redacted> + 524
26 UIKit 0x333cb8e1 <redacted> + 380
27 UIKit 0x333cb1ef <redacted> + 6198
28 GraphicsServices 0x350e35f7 <redacted> + 590
29 GraphicsServices 0x350e3227 <redacted> + 34
30 CoreFoundation 0x315913e7 <redacted> + 34
31 CoreFoundation 0x3159138b <redacted> + 138
32 CoreFoundation 0x3159020f <redacted> + 1382
33 CoreFoundation 0x3150323d CFRunLoopRunSpecific + 356
34 CoreFoundation 0x315030c9 CFRunLoopRunInMode + 104
35 GraphicsServices 0x350e233b GSEventRunModal + 74
36 UIKit 0x3341f2b9 UIApplicationMain + 1120
37 Facebook 0x0009d327 start + 111
38 Facebook 0x0009d2e0 start + 40
)
The facebook API did change a bit from the old build you were using to now. In your build.settings, do you have a line like "FacebookAppID = “xxxxxxxxxxxx”? This is a new requirement since the old build you used. See the documentation here: http://docs.coronalabs.com/guide/social/setupFacebook/index.html.
@Andrew: Thank you so much! That did the trick for me. I missed that one friggin’ line in my build.settings. Serves me right for working long hours w/out taking any coffee.
Same issue here. Facebook was working in the previous daily build (700-ish) but when I upgraded to build 1134, facebook.login doesn’t work anymore. Any ideas? I’ve tried using my appId in the Corona Facebook sample app and got the error below from the console:
Jun 6 20:48:58 Ericks-iPhone-5 Facebook[19929] <Warning>: Generic error
com.facebook.sdk:InvalidOperationException: 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
(
0 CoreFoundation 0x315bc3ff <redacted> + 186
1 libobjc.A.dylib 0x392b7963 objc_exception_throw + 30
2 CoreFoundation 0x315bc0d5 <redacted> + 0
3 Facebook 0x000a97cd start + 50453
4 Facebook 0x000ace11 start + 64345
5 Facebook 0x000aa42f start + 53623
6 Facebook 0x00188cb1 _ZNK6Corona12IOSFBConnect5LoginEPKcPS2_i + 364
7 Facebook 0x0018a53d _ZN6Corona15FacebookLibrary5loginEP9lua_State + 188
8 Facebook 0x0011a071 CoronaPushNativeObject + 172204
9 Facebook 0x00126ba1 CoronaPushNativeObject + 224220
10 Facebook 0x0011a25f CoronaPushNativeObject + 172698
11 Facebook 0x00113c2d CoronaPushNativeObject + 146536
12 Facebook 0x0012796f CoronaPushNativeObject + 227754
13 Facebook 0x0011a493 CoronaPushNativeObject + 173262
14 Facebook 0x00113c05 CoronaPushNativeObject + 146496
15 Facebook 0x0013d55b CoronaPushNativeObject + 316822
16 Facebook 0x00133557 CoronaPushNativeObject + 275858
17 Facebook 0x00136bb7 CoronaPushNativeObject + 289778
18 Facebook 0x00136fe5 CoronaPushNativeObject + 290848
19 Facebook 0x00136cbb CoronaPushNativeObject + 290038
20 Facebook 0x00136f87 CoronaPushNativeObject + 290754
21 Facebook 0x00152a65 CoronaPushNativeObject + 404128
22 Facebook 0x000d367f start + 222151
23 UIKit 0x3350c9ff <redacted> + 234
24 UIKit 0x3350c9ff <redacted> + 234
25 UIKit 0x333de5f9 <redacted> + 524
26 UIKit 0x333cb8e1 <redacted> + 380
27 UIKit 0x333cb1ef <redacted> + 6198
28 GraphicsServices 0x350e35f7 <redacted> + 590
29 GraphicsServices 0x350e3227 <redacted> + 34
30 CoreFoundation 0x315913e7 <redacted> + 34
31 CoreFoundation 0x3159138b <redacted> + 138
32 CoreFoundation 0x3159020f <redacted> + 1382
33 CoreFoundation 0x3150323d CFRunLoopRunSpecific + 356
34 CoreFoundation 0x315030c9 CFRunLoopRunInMode + 104
35 GraphicsServices 0x350e233b GSEventRunModal + 74
36 UIKit 0x3341f2b9 UIApplicationMain + 1120
37 Facebook 0x0009d327 start + 111
38 Facebook 0x0009d2e0 start + 40
)
The facebook API did change a bit from the old build you were using to now. In your build.settings, do you have a line like "FacebookAppID = “xxxxxxxxxxxx”? This is a new requirement since the old build you used. See the documentation here: http://docs.coronalabs.com/guide/social/setupFacebook/index.html.