这个问题快把我逼疯了,我不知道怎么解决它。

    Undefined symbols for architecture armv7:
  "_deflateEnd", referenced from:
      -[ASIDataCompressor closeStream] in ASIDataCompressor.o
  "_OBJC_CLASS_$_ASIDataDecompressor", referenced from:
      objc-class-ref in ASIHTTPRequest.o
  "_deflate", referenced from:
      -[ASIDataCompressor compressBytes:length:error:shouldFinish:] in ASIDataCompressor.o
  "_deflateInit2_", referenced from:
      -[ASIDataCompressor setupStream] in ASIDataCompressor.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

我认为这与:

ld: symbol(s) not found for architecture armv7

但是我添加了:libz.1.2.3。Dylib并没有帮助,有人有什么想法吗?


当前回答

我没有在这里找到这个建议,所以它是这样的: 如果你的项目有多个目标(即一个OSX和一个iOS),那么你必须为每个目标链接相关的库。例如,在我的情况下,我需要AudioToolbox..我不得不为OSX和iOS添加一次(在框架文件夹下,你必须有每个目标的每个库的副本..如果你只看到一个..那么这就是一个危险信号)

其他回答

回到你的项目,点击Build phases, Compile sources, Add GameCenterManager。M到列表上。

我也有类似的问题。在_OBJC_CLASS_$_后面的类名实际上是我的类。原因是我没有勾选“添加到目标”,当我拖动源代码文件到导航列表。

我的解决方案是:

从导航列表中删除类,并选择“仅删除引用” 再次拖动源代码文件,并确保“添加到目标”复选框被勾选。复选框就在“需要时复制”和“创建组”下面。

如果您在释放模式下构建您的Flutter项目时遇到了这个问题-这对我有帮助:

Set your build system to New Build System in File > Project Settings… delete folders ios and build_ios from your project folder. create ios module by executing flutter create . from your project folder. open Xcode and: set the IOS Deployment Target to at least 9.0 in PROJECT > Runner check your Signing & Capabilities make sure your Build Configuration is set to Release in Edit Scheme... and build for Generic iOS Device execute pod install from your project folder execute flutter pub get from your project folder

现在打开你的Xcode并构建或存档它:Product > build(或archive)

If you're building from Unity3D 5 and also using a Prime31 plugin and you're getting this error it's probably due to a duplicate .dll. If you look through your warnings in Unity's editor one of them will tell you this and warn that it could cause build errors. To see if this is the case, type P31 in your project search field and it should pop right up, maybe even more than one. The duplicate's will have a ' 1' at the end of the file name. This is probably caused from updating the plugin in editor via the store or the Prime31 menu tab.

我给你更多的建议,当其他常见的建议没有帮助时,你可以检查。

如果你链接到其他项目(libxxx.a),你有时可能会遇到奇怪的问题,你可以用nm等工具找到符号,但他们就是找不到ld中的符号。然后你应该检查两个项目是否构建在相同的标志中,其中一些可能会影响二进制格式。

检查c++编译器。 检查c++方言设置。 检查c++运行时类型支持。(-frtti / -fnortti) 检查是否有相同名称的.a出现在其他地方,可能超出了链接路径列表中的所需文件。移除它们。