报错:Undefined symbols for architecture i386 "_deflate"

报错:

Undefined symbols for architecture i386:
  "_inflate", referenced from:
      -[NSData(NSDataExtension) gzipInflate] in NSData+CocoaDevUsersAdditions.o
  "_inflate", referenced from:
      -[NSData(NSDataExtension) gzipInflate] in NSData+CocoaDevUsersAdditions.o
  "_inflateEnd", referenced from:
      -[NSData(NSDataExtension) gzipInflate] in NSData+CocoaDevUsersAdditions.o
  "_deflate", referenced from:
      -[NSData(NSDataExtension) gzipDeflate] in NSData+CocoaDevUsersAdditions.o
  "_deflate", referenced from:
      -[NSData(NSDataExtension) gzipDeflate] in NSData+CocoaDevUsersAdditions.o
  "_deflateEnd", referenced from:
      -[NSData(NSDataExtension) gzipDeflate] in NSData+CocoaDevUsersAdditions.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

解决方法:

You didn't include the libz.dylib where those functions are. Select the project node, select your target, go to the Build Phases tab, expand "Link Binaries With Libraries", add libz.dylib, and try again.


使用zlib的时候需要添加2个lib,因为之前只家了一个lib,所以处问题了,libz.dylib & libbz2.1.0.dylib

你可能感兴趣的:(IOS报错)