Facebook has released new 3.1 version of sdk for ios (and ios 6 compatible). You can target ios 5 also, just need to do small tweak during setup. They have details and tutorial on developers’ site. This post is not about any how to’s, here I will be talking about another few things that you need to be aware of and take care of it. I have integrated facebook sdk with android and iphone projects many times, but you can fall into one basic pitfall if not taken care of.

So your facebook app is ready. You have its app id and facebook sdk is well integrated with your project. You are ready to go. Now during facebook authentication from your app it gives this error (screenshot
below):

the operation couldn’t be completed com.facebook.sdk error 2
Now you will be thinking what went wrong? You’ll double check the facebook app id, and go through all settings you made and see if you have missed anything? But you find that everything is in its place. So what the duck is wrong with the program? What we are missing out is one basic setting during facebook app creation. If you check the facebook app dashboard again and look for native IOS App section. There you will find Bundle ID field, here you will have to enter your application bundle identifier so that facebook knows which app to redirect back to once auth is complete. This is very safe and you should provide this field on dashboard setting. Your application might run without that detail as I have tested this and confirmed it too that it has run on many other application without that setting but then in some devices/scenario it will definitely hit you. Your simulator and testing device might be running without issue but when you distribute it to some other device then you will face it eventually. So just be on safe side and provide your bundle identifier to your facebook app settings.