Saturday, September 22, 2012

Xcode: Drop the Docs Folder Symlinks -> Add a Copy of Facebook iOS SDK 3.0.8 to Your Project

It's against my alignment to have a project's free framework files consist of symbolic links linking to my current user's Documents folder.  This opens the door to time-wasting pitfalls later on, including git nightmares, and the delightfully unexpected when upgrading one package affects multiple projects.

But that's what the folks at Facebook tell you to do with the iOS SDK version 3.0.8.  After 'installing' the SDK, the effect is that the files are simply extracted to your Documents folder with explicit  (not relative) symbolic links .  This is by design.

(Alternatively, you could download the SDK source from Git.  But, dag nabbit, it has a different folder structure:  #thatstheshitidontlike)

Install the Facebook iOS SDK as per the documentation.  The default (invariable) location is in your Documents folder.
  • Copy the FacebookSDK.framework to your project's root folder.
  • In a terminal, navigate to this copy of the SDK's folder which is now in your project's folder.
  • Use the command 'ls -al' to list all.  You should see:
FacebookSDK -> ./Versions/A/FacebookSDK
Headers -> ./Versions/A/Headers
Resources -> ./Versions/A/Resources
  • Type 'rm FacebookSDK'  (you may need to do this as 'sudo rm FacebookSDK').  This will remove the symlink.
  • Using the previous symlink as a reference, replace this symlink with 'ln -s Versions/A/FacebookSDK'.
  • List all files again, you will see that this symlink is nearly the same except it's missing the preceding period.  That means it's now looking within its own child folders, not the default user's home directory.
You should be able to follow the rest of the tutorial.  Namely, copying the FacebookSDK.framework folder to your project's Framework directory.  After you complete their tutorial, press Command+B and watch that baby compile.

No comments:

Post a Comment