iosxcodefacebook

FacebookSDK 3.0 - Apple Mach-O Linker Error


I am trying to implement Facebook in one of my apps and therefore followed the official Facebook Tutorial on Hackbook. https://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/

I implemented everything as described and I don't get any error or warnings. However when I try to build the app, I get 17 Mach-O Linker Errors.

Undefined symbols for architecture i386:
  "_FBSessionStateChangedNotification", referenced from:
      -[ForeverMainViewController sessionStateChanged:state:error:] in ForeverMainViewController.o
  "_sqlite3_bind_double", referenced from:
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_bind_int", referenced from:
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _trimDatabase] in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_bind_text", referenced from:
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _readEntryFromDatabase:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _removeEntryFromDatabaseForKey:] in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_close", referenced from:
      ___23-[FBCacheIndex dealloc]_block_invoke_0 in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_column_double", referenced from:
      -[FBCacheIndex _readEntryFromDatabase:] in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_column_int", referenced from:
      -[FBCacheIndex _readEntryFromDatabase:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _fetchCurrentDiskUsage] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _trimDatabase] in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_column_text", referenced from:
      -[FBCacheIndex _readEntryFromDatabase:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _trimDatabase] in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_errmsg", referenced from:
      _releaseStatement in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in FacebookSDK(FBCacheIndex.o)
      _initializeStatement in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _readEntryFromDatabase:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _fetchCurrentDiskUsage] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _removeEntryFromDatabaseForKey:] in FacebookSDK(FBCacheIndex.o)
      ...
  "_sqlite3_exec", referenced from:
      ___36-[FBCacheIndex initWithCacheFolder:]_block_invoke_0 in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_finalize", referenced from:
      _releaseStatement in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_open_v2", referenced from:
      ___36-[FBCacheIndex initWithCacheFolder:]_block_invoke_0 in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_prepare_v2", referenced from:
      _initializeStatement in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_reset", referenced from:
      _initializeStatement in FacebookSDK(FBCacheIndex.o)
  "_sqlite3_step", referenced from:
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _readEntryFromDatabase:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _fetchCurrentDiskUsage] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _removeEntryFromDatabaseForKey:] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _dropTrimmingTable] in FacebookSDK(FBCacheIndex.o)
      -[FBCacheIndex _trimDatabase] in FacebookSDK(FBCacheIndex.o)
      ...
ld: symbol(s) not found for architecture i386

After reimplementing, cleaning the app, making sure everything was there, I am out of ideas. I also implemented it in another app, but good the errors again. The given samples from Facebook however work as intended. I did various tipps on the internet, but none of them worked so far. Maybe someone here knows something about the API and has a good tip for me :)


Solution

  • I think you are missing this line

    NSString *const FBSessionStateChangedNotification = @"FBSessionStateChangedNotification";

    and adding reference to -lsqlite3.0

    See https://developers.facebook.com/docs/getting-started/getting-started-with-the-ios-sdk/#project