ios XCode:架构 arm64 错误的未定义符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20926632/
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-08-30 22:59:14  来源:igfitidea点击:

XCode: Undefined symbols for architecture arm64 error

iosxcode5restkit

提问by Joseph

In my XCode 5 project I use RestKit for REST communication. Everything works fine with the simulators, but generating the ipa file, I get the following error:

在我的 XCode 5 项目中,我使用 RestKit 进行 REST 通信。模拟器一切正常,但生成 ipa 文件时,出现以下错误:

ld: warning: ignoring file /Users/joseph/Library/Developer/Xcode/DerivedData/XXXXXXXXXX-gdwdekevxtdfivfpsnmyykeqhulk/Build/Products/Debug-iphoneos/libRestKit.a, missing required architecture arm64 in file /Users/joseph/Library/Developer/Xcode/DerivedData/XXXXXXXXXXXXX-gdwdekevxtdfivfpsnmyykeqhulk/Build/Products/Debug-iphoneos/libRestKit.a (2 slices)
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_RKRelationshipMapping", referenced from:
      objc-class-ref in classname-xxx.o
  "_OBJC_CLASS_$_RKObjectMapping", referenced from:
      objc-class-ref in classname-xxx.o
  "_OBJC_CLASS_$_RKRequestDescriptor", referenced from:
      objc-class-ref in classname-xxx.o
  "_OBJC_CLASS_$_RKObjectManager", referenced from:
      objc-class-ref in classname-xxx.o
  "_OBJC_CLASS_$_RKResponseDescriptor", referenced from:
      objc-class-ref in classname-xxx.o

  "_RKStatusCodeIndexSetForClass", referenced from:
      -[classname-xxx classname-Method] in classname-xxx.o
      -[classname-xxx classname-Method] in classname-xxx.o
      -[classname-xxx classname-Method] in classname-xxx.o
      -[classname-xxx classname-Method] in classname-xxx.o
      -[classname-xxx classname-Method] in classname-xxx.o
  "_RKMIMETypeJSON", referenced from:
      -[classname-xxxinitWithURLBase:timeOut:] in classname-xxx.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation).

If in RestKit project, I change in "Build Settings" -> "Architectures" the "Standard architectures (ARMv7, armv7s)" by Standard architectures (including 64-bit) (ARMv7, armv7s, arm64) option, everything compiles fine . Is this correct?, Does not bring any result, I have to change some other settings.

如果在 RestKit 项目中,我通过标准体系结构(包括 64 位)(ARMv7、armv7s、arm64)选项在“构建设置”->“体系结构”中更改“标准体系结构(ARMv7,armv7s)”,则一切都可以正常编译。这是正确的吗?,没有带来任何结果,我必须更改一些其他设置。

回答by Js Lim

  1. Select Restkit project
  2. Set the Build Active Architecture Onlyto No
  1. 选择 Restkit 项目
  2. 仅构建活动架构设置为No

Build Active Architecture Only

仅构建主动架构

回答by Refael.S

It just means you are building your project also for 64bit (iPhone 5s) and nothing to worry about, see this link for some more explanations: Xcode 5 and iOS 7: Architecture and Valid architectures

这只是意味着您正在为 64 位(iPhone 5s)构建您的项目,无需担心,请参阅此链接以获取更多解释: Xcode 5 和 iOS 7:架构和有效架构

回答by lukszar

Just change in RestKit project -> Build Settings -> Architectures to Standard Architecture (armv7, armv7s, arm64). After that everything should work.

只需将 RestKit 项目 -> 构建设置 -> 架构更改为标准架构(armv7、armv7s、arm64)。之后,一切都应该工作。

回答by keshav

I ran into the same/similar issue implementing AVPictureInPictureController and the issue was that I wasn't linking the AVKit framework in my project.

我在实现 AVPictureInPictureController 时遇到了相同/类似的问题,问题是我没有在我的项目中链接 AVKit 框架。

The error message was:

错误消息是:

Undefined symbols for architecture armv7:

架构 armv7 的未定义符号:

"_OBJC_CLASS_$_AVPictureInPictureController", 
referenced from:
   objc-class-ref in yourTarget.a(yourObject.o)
ld: symbol(s) not found for architecture armv7

clang: error: linker command failed with exit code 1 (use -v to see invocation) The Solution:

clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) 解决方案:

Go to your Project Select your Target Then, go to Build Phases Open Link Binary With Libraries Finally, just add + the AVKit framework / any other framework. Hopefully this helps someone else running into a similar issue I had.

转到您的项目 选择您的目标 然后,转到 Build Phases Open Link Binary With Libraries 最后,只需添加 + AVKit 框架/任何其他框架。希望这可以帮助其他人遇到我遇到的类似问题。

回答by Shashank Saxena

This worked for me:

这对我有用:

ios sdk 9.3

IOS SDK 9.3

into your build setting of app.xcodeproj valid architecture: armv7 armv7s Build Active architecture : No

进入 app.xcodeproj 的构建设置有效架构​​:armv7 armv7s 构建活动架构:否

Clean and build , worked for me.

清洁和建造,为我工作。

回答by Arvind Kumar

In my case i forgot to add sqlite library in my project. After adding library from Linked framework and library the build was successful.

就我而言,我忘记在我的项目中添加 sqlite 库。从链接框架和库添加库后,构建成功。