Apple Mach-O Linker Error ZBarSDK error when build

2020-05-20 03:33发布

I just got this same error when using ZBarSDK, a bar scanning library for iOS. It runs fine when I upload it to my development device or test it on the iOS6 simulator. But when I try to run it for Distribution it fails with:

(null): File is universal (3 slices) but does not contain a(n) armv7s slice: /Users/quique123/Documents/iphone apps/ScanThis/ZBarSDK/libzbar.a for architecture armv7s

where libzbar.a is the library from the sdk.

Any ideas?

标签: linker ios6
7条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-05-20 03:43

Simply remove the bad architecture from Valid Architectures in Target Aguilar Settings and you're good to go :)

查看更多
混吃等死
3楼-- · 2020-05-20 03:44

I just replaced in Build Settings / Valid Architectures: "armv7" for 2 rows "armv6" and "armv7"

(Usually I used to get this linker error only when submitting to iTunes, but not debugging in device)

查看更多
唯我独甜
4楼-- · 2020-05-20 03:47

Just remove the "armv7s", this will work :)

查看更多
够拽才男人
5楼-- · 2020-05-20 03:53

You can download the new build of ZBarSDK in URL below.

http://sourceforge.net/projects/zbar/files/iPhoneSDK/beta/

查看更多
Emotional °昔
6楼-- · 2020-05-20 03:56

Open up the ZBar code Mercurial code repo

http://zbar.hg.sourceforge.net/hgweb/zbar/zbar/summary

Go to the bz2/zip/gz links to download current source (in preferred format)

http://zbar.hg.sourceforge.net/hgweb/zbar/zbar/archive/fa84e0427c24.tar.bz2 (as of this post date) http://zbar.hg.sourceforge.net/hgweb/zbar/zbar/archive/fa84e0427c24.zip (as of this post date) http://zbar.hg.sourceforge.net/hgweb/zbar/zbar/archive/fa84e0427c24.tar.gz (as of this post date)

Open the 'iphone' subdirectory

Open the 'zbar.xcodeproj' file

In the scheme's menu select libzbar and build your own binary version in the supported architecture

Open the DerivedData for that project and navigate to Build/Products/

Look in all of the folders for libzbar.a

查看更多
老娘就宠你
7楼-- · 2020-05-20 03:59

Set 'Build Active Architecture Only' to YES for release. I fixed my problem by doing so as I was facing this same problem.

查看更多
登录 后发表回答