FacebookSDK 3.0 - Apple Mach-O链接器错误

时间:2012-08-11 18:42:19

标签: ios xcode facebook api

我正在尝试在我的一个应用程序中实现Facebook,因此遵循Hackbook上的官方Facebook教程。 https://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/

我按照描述实现了所有内容,但我没有收到任何错误或警告。然而,当我尝试构建应用程序时,我得到17个Mach-O链接器错误。

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

重新实现后,清理应用程序,确保一切都在那里,我没有想法。我也在另一个应用程序中实现了它,但再次好错了。然而,来自Facebook的给定样本按预期工作。我在互联网上做了各种各样的tipps,但到目前为止它们都没有。也许这里的某些人对API有所了解并且对我有很好的建议:)

3 个答案:

答案 0 :(得分:19)

我认为你错过了这一行

NSString * const FBSessionStateChangedNotification = @“FBSessionStateChangedNotification”;

并添加对-lsqlite3.0的引用

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

答案 1 :(得分:4)

我认为你错过了这个

Goto Project-> BuildPhase-> Link Binary-Add-> -lsqlite3.0

答案 2 :(得分:1)

是的,我找到了解决方案:libsqlite3.dylib我使用的编译为armv6而不是7,所以你下载Xcode dmg文件(超过4.2)并从中提取lib。