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

    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并没有帮助,有人有什么想法吗?


当前回答

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.

其他回答

当我加入第三方框架时,我也遇到了同样的问题。

当我从目标的构建设置中的有效架构条目中删除armv7s时,问题得到了解决,它开始工作。

最后我想明白了,我通过添加缺少框架的目标->构建阶段->链接二进制库解决了这个问题

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

我的解决方案是:

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

我在安装shareKit时遇到了这个问题。它可以在模拟器中运行,但不能在设备上运行。我从其他链接器标志中删除了-all_load,一切都在模拟器和iphone设备中正常工作。

我只添加了libz.1.2.5。Dylib到我的项目,它的工作就像一个魅力。

步骤,

进入构建阶段。 Link Binary With library -使用“+”按钮选择要添加的框架和库。 选择libz.1.2.5。列表中的Dylib。 构建并运行。