by

How to use Ti.Facebook in TiShadow

You can use any native module in TiShadow by building them into the TiShadow App before running an app over TiShadow. However, to be able to use Ti.Facebook or the separate Facebook module in 3.1 or later, you also need to set a valid Facebook App ID. This Facebook App needs it Bundle ID to match the id in your app’s tiapp.xml, but when you run the app over TiShadow it will use the tiapp.xml of the TiShadow app instead. So, how to solve this?

  1. Make sure you’ve changed the default id in the tiapp.xml of the TiShadow App to something other then the default. Read Stephan’s blog for more detail on why and how to do this.
  2. Create a new Facebook App
    • Choose any App Name, e.g. ‘TiShadow’
    • Check Native iOS App and enter the Application ID of your TiShadow App (step 1) as the Bundle ID.
  3. Set-up Facebook in the tiapp.xml of the TiShadow app:
    • For Titanium SDK 3.1 or later, add the separate Facebook module:
    • Add the property containing your Facebook App ID:
  4. In the JavaScript of the app you want to run over TiShadow, grab the Facebook App ID from the add-hoc property in tiapp.xml instead of hard-coding it:
    • Titanium SDK 3.1 or later:
    • Titanium 3.0 or older:

Now whenever you run the app over TiShadow, it will use the Facebook App ID in the tiapp.xml of the TiShadow app. When you the app standalone it will look for the Facebook App ID in the tiapp.xml of the actual app instead. So make sure you setup Facebook for the actual app in the same way as described above, but then using the actual id as the Bundle ID.