xcode 架构 i386 的未定义符号:“_OBJC_CLASS_$_Barcode”,引用自:objc-class-ref in

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

Undefined symbols for architecture i386: "_OBJC_CLASS_$_Barcode", referenced from: objc-class-ref in

iosxcodegeneratorqr-code

提问by jimbob

I am trying to integrate a QR code generating library in to my App.

我正在尝试将二维码生成库集成到我的应用程序中。

the QR generator library is:

QR 生成器库是:

https://github.com/kuapay/iOS-QR-Code-Generator

https://github.com/kuapay/iOS-QR-Code-Generator

I guess I must have integrated it wrong as I am getting this error:

我想我一定是错误地集成了它,因为我收到了这个错误:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_Barcode", referenced from:
      objc-class-ref in QRViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What is most likely to be causing this?

最有可能导致这种情况的原因是什么?

回答by Matt Wilding

You're most likely linking against a version of the library that was compiled for the device (ARMv6/v7 architecture), while trying to compile for the simulator (i386 architecture). Try running on a device instead.

您很可能在尝试为模拟器(i386 架构)编译时链接到为设备编译的库版本(ARMv6/v7 架构)。尝试在设备上运行。

If running it on a device doesn't work either, then you may not be linking against the library at all, and you should verify that you see the library in your project's "Link Binary With Libraries" build phase.

如果在设备上运行它也不起作用,那么您可能根本没有链接到库,并且您应该验证您是否在项目的“链接二进制与库”构建阶段看到了该库。

回答by AliBoyraz

My problem is solved like that.
Please follow the directions:

我的问题就这样解决了。
请按照以下说明操作:

TargetSettings -> Build Phases -> Compile Sources -> add your .m class  ->Build and Run

回答by MD Aslam Ansari

I have fixed my issue by first changing the target to a library and pressed "CMD + B", which will build the all the library file. Then changing back to main target to compile and run on the device.

我通过首先将目标更改为库并按下“CMD + B”来解决我的问题,这将构建所有库文件。然后改回主目标以在设备上编译和运行。

Note: I am using cocoapods and also have my own custom dynamic library in my project.

注意:我正在使用 cocoapods,并且在我的项目中也有我自己的自定义动态库。

回答by Hemanshu Liya

I solved the same issue by going to Xcode Build settings and in Architecture changed the standard architecture to :-

我通过转到 Xcode 构建设置解决了同样的问题,并在架构中将标准架构更改为:-

$(ARCHS_STANDARD_32_BIT)

$(ARCHS_STANDARD_32_BIT)

回答by wtorsi

Clean your DerivedData folder, this helps me

清理你的 DerivedData 文件夹,这对我有帮助

mv ~/Library/Developer/Xcode/DerivedData ~/Library/Developer/Xcode/DerivedData.old