Getting Up To Speed On Facebook Integration... Tips/advice?

Hi All,

It’s time for me to sort out some basic Facebook functionality for my current project.

There’s good information here on the forum but there’s a lot to sort through. I’m starting to get an idea of how to approach working with the Facebook API but still need to learn a lot.

Can anyone share any advice or links to forum posts/tutorials/documentation/community code that was most helpful to them?

I’m working on a platformer style game. Between each level and on winning I’d like to give the player the option to post their score and progress message and/or image to FB. That should pretty do-able… correct?

Thanks in advance for any help/tips/advice :slight_smile:

Hey, Jedi @EHO, I suggest:

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

http://developers.facebook.com/docs/reference/api/

https://developers.facebook.com/docs/howtos/scores/

And the Facebook sample code that comes bundled with Corona SDK.

Once you become familiar with how it works, and if you come to a road block, post up a code, and I’m sure someone will help trouble shoot.

Good luck!

Naomi

Hi Naomi,

I appreciate the links. Somehow in my research I had missed that first one related to Corona. It looks very helpful.

I had looked at the Facebook sample app but since it looks to be 3 or so years old I wasn’t sure how relevant it was.

Broadly speaking, how intensive do you rate Facebook integration relative to other aspects of Corona development you’ve worked through? I feel like it might actually be pretty straightforward once I get my head around all the various sources of info that’s out there.

Thanks for your input :slight_smile:

Hi Jedi, the FB integration was a pain in the neck especially when Corona updated its FB integration earlier this year.  It broke previously working version of my code, and it took a while before Corona could fix the problem.  I spent hours and hours on it.  But it all worked out, and I guess I learned even more in the process.

That said, when I first integrated FB with my first project, it was definitely easier than integrating In-App Purchase.  And, as you suspect, it’s pretty straight forward – just as IAP feels straight forward once you sort things out.

I believe FB sample app that comes bundled with Corona SDK still works.  Make sure to follow the Guide page, and take close look at the API pages detailing facebook.login, facebook.request, etc.  It will also help to take a look at FB dev portal and pay attention to what it says about each API (such as score API.)  I was clueless when I started, but it doesn’t seem so alien to me now.

Naomi

Hi Naomi,

I’ve been digging into this and can see that with the building to local hardware I’ve been doing that I’ve only uncovered the tip of the iceberg as far as iOS development goes…

To this point, I’ve only really used a Development Provisioning Profile with an App ID that has a “wildcard” identifier (" * " so that I can use it with whatever I’m working on… at least that’s what I think that’s for?!).

From what I’ve learned through those links you shared, to get set up with Facebook, I need to have an App Store ID which means that I need to add an app to iTunes Connect (which generates an App Store ID), right?

Here are some questions I’ve been trying to figure out…
-Can I add an app to iTunes connect but not release?
-I’m assuming that I can’t use a wildcard App ID (" * ") for building an app I submit to iTunes Connect?
-I’m guessing my submission needs to be built with a Distribution Provisioning Profile rather than a Development Provisioning Profile?

These are the steps I’m going to attempt in order to be able to get set up with working with Facebook:

  1. As far as my Certificates, Identifiers and Profiles go, I have a good Certificate. Next step is to make sure I have an App ID with ID that’s in the “com.mydomain.name” format.
  2. Next I’ll make a new Distribution Provisiong Profile with this ID.
  3. Then I’ll submit this to iTunes Connect and get an App Store ID but not publish the app (which won’t be totally done anyways) with which I can then input into my Facebook App registration.

Does it seem like I’m on track?

Thank you Jedi Master! :slight_smile:

Hi EHO (and I honestly thought your name was Jedi until I really looked – how silly of me),

Here are my thoughts.

I’ve never used wildcard identifier myself, and whenever I start a project, I always create an app in iTunes right away.  And yes, you don’t have to release an app immediately after you add it to iTunes.  You don’t have to upload any binary until you are ready, and even if you upload one, you don’t have to release it (by doing the Developer Reject, etc.), and even if your app is approved, you don’t have to release it right away (by setting a release date to sometime way into the future, or by not selecting any store at all, etc.)

I don’t know if you can use wildcard to generate a release build for Apple submission.  As I mentioned, I’ve never used one, so I’ve never looked into what limitation it has.

As for the type of certificate, as far as I am aware, only build that Apple would accept is the one built with Distribution Provisioning Profile.  That said, you can test Facebook using a build generated with Developer or AdHoc profile.  In my case, during my test phase, I always generate build using AdHoc.

I don’t think you need to upload binary to iTunes to test Facebook.  But, to test Facebook before the app is released to iOS or Android markets, what I always do, and what I think helps, is to include “Website with Facebook Login” and “Mobile Web” along with Native iOS App and Native Android App (at FB Dev Portal).  I sort of remember, way back when I first tried integrating and testing Facebook, I could not test it without my app already released – and the workaround appeared to require adding Website and Mobile Web into the mix along with Native iOS and Native Android App.  Things could have changed and it may no longer be necessary, but I figure I don’t need to change/experiment on something I know works, so I continue integrating and testing FB the same way.  (And yes, I do have a hosted website that I can point to.)

I hope this helps.  Good luck!

Naomi

Hi Naomi,

I made some good progress over the weekend. Fortunately I have a domain as well so I was able to set up a subdomain and use that while making an AdHoc Provisioning Profile. I was able to use that in regards to adding an app on iTunes Connect which then gave me the Apple ID I needed to get set up with a Facebook App. Facebook does say that they check the subdomain associated with the profile so it was important that I had set that up (although I didn’t try without it…).

It all sounds really straightforward now that I’m explaining it, and really it was, but it did take me a lot of time to methodically work through it. The good news of course is that now that I’ve done this once, it really will be that much easier in the future.

So now that I’m set up with a FB app on my developer account, I’m actually sort of forgetting what I was working up to in the first place!

I need to update my build settings with my FB App ID now that I have it.

I guess I can now get going with FB’s Graph API? Do I set up some sort of test account to test things with? I think I had read that somewhere.

Thank you for your input! :slight_smile: There were some gems of information that would have been hard for me to come around on on my own (the idea of needing a subdomain to match the one listed!). I still need to add “Website with Facebook Login” and “Mobile Web” to my FB App and it sounds like that was important to do…

About test account, you might want to look into their sandbox environment (not that I tried it.)

Good luck!

Naomi

Hi Naomi,

I did end up setting up my FB app with both “Website with FB Login” and “Mobile Web” settings since you had said you did the same. I used http://subdomain.mydomain.com for both. Is that what you had used? 

Are you able to test the FB API in the Corona Simuator? I had read at the end of this tutorial that the FB API doesn’t run in the Corona Simulator and that I must use the Xcode iOS simulator (need to figure out how to open that!)

http://mobile.tutsplus.com/tutorials/corona/corona-sdk-working-with-the-facebook-graph-api-part-2/

I’ve set the Facebook sample app up with my FB App ID. The Corona Simulator displays an error message any time a button release calls the facebook.login() function claiming the first argument (app id) should be a string. So something’s not quite right yet…

Ha! OK, I slept on it and realized if I was getting an error about not passing a string, I could make my App ID a string by placing the number in quotes and that seems to solve that error message (“123456” instead of 123456). Is that correct to put the App ID number value into quotes to make it a string?

The simulator output does now give me a Warning that facebook.login() is not supported on the simulator (which confirms my question from last post about whether FB can be tested on the Corona simulator). 

How do you test your FB integration? Build to hardware?

Hey, EHO, I do place my FB App ID inside the quotes, and yes, it does make it a string.  About testing FB, I always test it on device.  It’s a pain in the neck.  I believe there’s a tool in code share that enables you to test FB via Corona simulator, but I  haven’t used it because mine stated working with out it, but I think it’s a great tool.

Naomi

Hey, Jedi @EHO, I suggest:

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

http://developers.facebook.com/docs/reference/api/

https://developers.facebook.com/docs/howtos/scores/

And the Facebook sample code that comes bundled with Corona SDK.

Once you become familiar with how it works, and if you come to a road block, post up a code, and I’m sure someone will help trouble shoot.

Good luck!

Naomi

Hi Naomi,

I appreciate the links. Somehow in my research I had missed that first one related to Corona. It looks very helpful.

I had looked at the Facebook sample app but since it looks to be 3 or so years old I wasn’t sure how relevant it was.

Broadly speaking, how intensive do you rate Facebook integration relative to other aspects of Corona development you’ve worked through? I feel like it might actually be pretty straightforward once I get my head around all the various sources of info that’s out there.

Thanks for your input :slight_smile:

Hi Jedi, the FB integration was a pain in the neck especially when Corona updated its FB integration earlier this year.  It broke previously working version of my code, and it took a while before Corona could fix the problem.  I spent hours and hours on it.  But it all worked out, and I guess I learned even more in the process.

That said, when I first integrated FB with my first project, it was definitely easier than integrating In-App Purchase.  And, as you suspect, it’s pretty straight forward – just as IAP feels straight forward once you sort things out.

I believe FB sample app that comes bundled with Corona SDK still works.  Make sure to follow the Guide page, and take close look at the API pages detailing facebook.login, facebook.request, etc.  It will also help to take a look at FB dev portal and pay attention to what it says about each API (such as score API.)  I was clueless when I started, but it doesn’t seem so alien to me now.

Naomi

Hi Naomi,

I’ve been digging into this and can see that with the building to local hardware I’ve been doing that I’ve only uncovered the tip of the iceberg as far as iOS development goes…

To this point, I’ve only really used a Development Provisioning Profile with an App ID that has a “wildcard” identifier (" * " so that I can use it with whatever I’m working on… at least that’s what I think that’s for?!).

From what I’ve learned through those links you shared, to get set up with Facebook, I need to have an App Store ID which means that I need to add an app to iTunes Connect (which generates an App Store ID), right?

Here are some questions I’ve been trying to figure out…
-Can I add an app to iTunes connect but not release?
-I’m assuming that I can’t use a wildcard App ID (" * ") for building an app I submit to iTunes Connect?
-I’m guessing my submission needs to be built with a Distribution Provisioning Profile rather than a Development Provisioning Profile?

These are the steps I’m going to attempt in order to be able to get set up with working with Facebook:

  1. As far as my Certificates, Identifiers and Profiles go, I have a good Certificate. Next step is to make sure I have an App ID with ID that’s in the “com.mydomain.name” format.
  2. Next I’ll make a new Distribution Provisiong Profile with this ID.
  3. Then I’ll submit this to iTunes Connect and get an App Store ID but not publish the app (which won’t be totally done anyways) with which I can then input into my Facebook App registration.

Does it seem like I’m on track?

Thank you Jedi Master! :slight_smile:

Hi EHO (and I honestly thought your name was Jedi until I really looked – how silly of me),

Here are my thoughts.

I’ve never used wildcard identifier myself, and whenever I start a project, I always create an app in iTunes right away.  And yes, you don’t have to release an app immediately after you add it to iTunes.  You don’t have to upload any binary until you are ready, and even if you upload one, you don’t have to release it (by doing the Developer Reject, etc.), and even if your app is approved, you don’t have to release it right away (by setting a release date to sometime way into the future, or by not selecting any store at all, etc.)

I don’t know if you can use wildcard to generate a release build for Apple submission.  As I mentioned, I’ve never used one, so I’ve never looked into what limitation it has.

As for the type of certificate, as far as I am aware, only build that Apple would accept is the one built with Distribution Provisioning Profile.  That said, you can test Facebook using a build generated with Developer or AdHoc profile.  In my case, during my test phase, I always generate build using AdHoc.

I don’t think you need to upload binary to iTunes to test Facebook.  But, to test Facebook before the app is released to iOS or Android markets, what I always do, and what I think helps, is to include “Website with Facebook Login” and “Mobile Web” along with Native iOS App and Native Android App (at FB Dev Portal).  I sort of remember, way back when I first tried integrating and testing Facebook, I could not test it without my app already released – and the workaround appeared to require adding Website and Mobile Web into the mix along with Native iOS and Native Android App.  Things could have changed and it may no longer be necessary, but I figure I don’t need to change/experiment on something I know works, so I continue integrating and testing FB the same way.  (And yes, I do have a hosted website that I can point to.)

I hope this helps.  Good luck!

Naomi

Hi Naomi, 

I was able to finally get a test app set up and working with Facebook earlier this week. As I suspected, it seems really easy in hindsight! I appreciate all your insight, I would not have had the success I had without it.

I took the guts of this tutorial which pulls the user profile image of all your friends and tiles them randomly on your screen. It’s kind of cool in it’s own right. Pulling this info from my facebook account and displaying it in my app is one of the neatest experiences I’ve had as an app developer:

http://mobile.tutsplus.com/tutorials/corona/corona-sdk-working-with-the-facebook-graph-api-part-2/

If anyone else is looking for a sample to test out facebook integration with, I like this sample because you get a very visual result off of it. You know it’s working when it is! Please note that the build.settings didn’t work for me as specified in the tutorial. I had to set them up as specified in the Corona API which is different because it includes the “fbXXXXXXXXX” app ID string.

So I’ve got my app set up with FB and I can pull data (images) from my account. The next step for me is to figure out how to post to Facebook. How does a person test posting to facebook without posting all kinds of random things to one’s wall? Is there some test account available?

Thanks for all your help Naomi, it made a decided difference for me :slight_smile:

Hi Naomi,

I made some good progress over the weekend. Fortunately I have a domain as well so I was able to set up a subdomain and use that while making an AdHoc Provisioning Profile. I was able to use that in regards to adding an app on iTunes Connect which then gave me the Apple ID I needed to get set up with a Facebook App. Facebook does say that they check the subdomain associated with the profile so it was important that I had set that up (although I didn’t try without it…).

It all sounds really straightforward now that I’m explaining it, and really it was, but it did take me a lot of time to methodically work through it. The good news of course is that now that I’ve done this once, it really will be that much easier in the future.

So now that I’m set up with a FB app on my developer account, I’m actually sort of forgetting what I was working up to in the first place!

I need to update my build settings with my FB App ID now that I have it.

I guess I can now get going with FB’s Graph API? Do I set up some sort of test account to test things with? I think I had read that somewhere.

Thank you for your input! :slight_smile: There were some gems of information that would have been hard for me to come around on on my own (the idea of needing a subdomain to match the one listed!). I still need to add “Website with Facebook Login” and “Mobile Web” to my FB App and it sounds like that was important to do…

About test account, you might want to look into their sandbox environment (not that I tried it.)

Good luck!

Naomi

Hi Naomi,

I did end up setting up my FB app with both “Website with FB Login” and “Mobile Web” settings since you had said you did the same. I used http://subdomain.mydomain.com for both. Is that what you had used? 

Are you able to test the FB API in the Corona Simuator? I had read at the end of this tutorial that the FB API doesn’t run in the Corona Simulator and that I must use the Xcode iOS simulator (need to figure out how to open that!)

http://mobile.tutsplus.com/tutorials/corona/corona-sdk-working-with-the-facebook-graph-api-part-2/

I’ve set the Facebook sample app up with my FB App ID. The Corona Simulator displays an error message any time a button release calls the facebook.login() function claiming the first argument (app id) should be a string. So something’s not quite right yet…