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?
- Make sure you’ve changed the default
id
in thetiapp.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. - 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.
- Set-up Facebook in the
tiapp.xml
of the TiShadow app:- For Titanium SDK 3.1 or later, add the separate Facebook module:
1234<modules><module platform="android">facebook</module><module platform="iphone">facebook</module></modules> - Add the property containing your Facebook App ID:
1<property name="ti.facebook.appid">FACEBOOK_APP_ID</property>
- For Titanium SDK 3.1 or later, add the separate Facebook module:
- 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:
1require('facebook').appid = Ti.App.Properties.getString('ti.facebook.appid');
- Titanium 3.0 or older:
1Ti.Facebook.appid = Ti.App.Properties.getString('ti.facebook.appid');
- Titanium SDK 3.1 or later:
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
.