Facebook Problems.. yet again

NOTE: I believe I have fixed this issue (I’m trying now) and will be posting my solution plus a full tutorial on how I’m trying to make the posting experience as easy as possible for the user.

First off I have to rant a little… this whole incorporation of Facebook into Corona is $*($ terrible… I haven’t yelled so many choice words in a year of developing with Corona until I ran into Facebook.

I do realize this is partially because of Facebook’s policies, etc… but there HAS to be a better way than this… this is awful… Why do I have to make my user leave my app to approve the app? Take any useability class and come back and tell me this makes sense? I know this is prob due to Facebook forcing the SSO crap on Corona but it’s worth complaining about (makes me feel better).


So my problem is similar as to what has been posted before. I had to change my facebook posting (which was very nice and easy, I wrote a tutorial about that I’m now glad I didn’t release due to the changes), and it no longer works)…

I’ve setup the facebook with a valid App ID from iTunes connect, and I’ve specified my bundle in my build.settings file, along with the rest of the necessary requirements from the SSO tutorial.

When I hit login, it leaves the app (stupid), and then the dialog comes up asking for authorization. I authorize and it goes to a blank screen, and drops me back out into the Facebook App without switching me back to the app.

My guess is that my bundle identifier is wrong. That’s the only thing I can come up with. I’m assuming the app uses this for fast app switching. But I get nothing. If I build for device with a developer profile, but set my bundle in the app as below, will this still be valid?

[lua]ettings =
{
orientation =
{
default =“portrait”,
content = “portrait”,
supported =
{
“portrait”
},
},

iphone =
{
plist =
{
CFBundleIdentifier = “com.MorVid.FBTest”,
CFBundleURLTypes =
{
{
CFBundleURLSchemes =
{
“fb494617574”,
}
}
}

},

–components = {},
},
}[/lua]

The code I’m using is straight from the tutorial on posting an image to facebook:

[lua]local facebook = require “facebook”

– You must use your own app id for this sample to work
local fbAppID = “124567890” – valid appID here

local function onLoginSuccess()
– Upload ‘iheartcorona.jpg’ to current user’s account
local attachment = {
message = “Just a description of the photo.”,
source = { baseDir=system.ResourceDirectory, filename=“test.jpg”, type=“image” }
}

facebook.request( “me/photos”, “POST”, attachment )
end

– facebook listener
local function fbListener( event )
if event.isError then
native.showAlert( “ERROR”, event.response, { “OK” } )
else
if event.type == “session” and event.phase == “login” then
– login was a success; call function
onLoginSuccess()

elseif event.type == “request” then
– this block is executed upon successful facebook.request() call

native.showAlert( “Success”, “The photo has been uploaded.”, { “OK” } )
end
end
end

local function doStart(event)
if (event.phase == “began”) then
print(“Doing Facebook”);
– photo uploading requires the “publish_stream” permission
facebook.login( fbAppID, fbListener, { “publish_stream” } )
end
end

local button = display.newRect(display.contentCenterX, display.contentCenterY + 100, 100, 100)
button:addEventListener(“touch”, doStart)[/lua]

So any guesses or ideas as to why it won’t swap? Also, does the bundle change if not signed with an Ad-Hoc profile?

And last, did I mention this whole process is awful and keeps changing? Can this not be abstracted from within Corona itself? It’d be amazing to integrate these changes and abstract the rest to us:

  1. Provide an API key
  2. Call login
  3. Call postToFeed(required params here)
  4. Call postImage(required params here)
  5. Receive callback letting us know it worked/failed

How AMAZING would that be?! Same with Twitter?!

Thanks for listening to me complain, it’s just been a really frustrating couple of days, and thanks for any and all support/comments/arguments!

-David

NOTE: Removing the facebook app causes it to open the web browser and after authorization it says: “Cannot Open Page.” I’m assuming this is the part trying to open the app back up? [import]uid: 27681 topic_id: 24637 reply_id: 324637[/import]

Declaring the bundle ID in my build.settings has given me problems in the past. Some of your issues may be coming from that. [import]uid: 10903 topic_id: 24637 reply_id: 99825[/import]