Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Facebook SDK - define FacebookAppID remotely

Working with iOS Facebook SDK 3.0, it needs to define FacebookAppID and the related URL Scheme with it on the info.plist of the app. I want to define these remotely (request to my own server for app id). So 2 different questions:

  1. Can I alter info.plist of the app in runtime? Or can I define FacebookApID and URL Scheme in another plist where I can alter the plist or even create a new custom plist file?
  2. Is there another way to define URL Scheme and App ID, other than using info.plist for Facebook SDK 3.0 ?
like image 639
Bartu Avatar asked Dec 05 '22 11:12

Bartu


1 Answers

1.1 No you cannot alter the Info.plist file at runtime.

1.2 No you cannot load another plist file to override settings in Info.plist.

2.1 Yes, you can define FacebookApID without altering Info.plist file, by calling [FBSettings setDefaultAppID:@"Your Facebook App ID"]; See the source code of FBSettings.h in Facebook iOS SDK.

2.2 No, URL Scheme must be defined in Info.plist so iOS can recognize it. I believe that the URL Scheme is read by iOS when installing your app, and it is cached elsewhere in system. Even if you can alter your Info.plist, the system won't pick up your new URL Scheme. But don't worry, there's a workaround for Facebook authentication without using URL schemes! We can force the Facebook iOS SDK to use UIWebView for login, see this stackoverflow question.

like image 93
howanghk Avatar answered Dec 24 '22 09:12

howanghk