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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11916682/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:12:36  来源:igfitidea点击:

FacebookSDK 3.0 - Apple Mach-O Linker Error

iosxcodefacebookapi

提问by Blade

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/

我正在尝试在我的一个应用程序中实施 Facebook,因此遵循了 Hackbook 上的官方 Facebook 教程。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.

我按照描述实施了所有内容,但没有收到任何错误或警告。但是,当我尝试构建应用程序时,我收到 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

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 :)

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

回答by user1325394

I think you are missing this line

我想你错过了这一行

NSString *const FBSessionStateChangedNotification = @"FBSessionStateChangedNotification";

NSString *const FBSessionStateChangedNotification = @"FBSessionStateChangedNotification";

and adding reference to -lsqlite3.0

并添加对 -lsqlite3.0 的引用

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

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

回答by btmanikandan

I think your are missing this

我想你错过了这个

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

转到 Project->BuildPhase->Link Binary-Add->-lsqlite3.0

回答by Vaibhav Sharma

Yes, I found the Solution : libsqlite3.dylibthat i used compiled for armv6 not 7 , so you download Xcode dmg file (more then 4.2)and extract the lib from it .

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