简体   繁体   中英

iPhone Build fails - XCode 5.1.1 iOS 7

I've followed this bar code scanner tutorial http://rdcworld-iphone.blogspot.com.au/2013/03/how-to-use-barcode-scanner-br-and-qr-in.html which runs fine in the simulator. However it says "Build Failed" when I connect my iPhone and attempt to build it. There are no errors. My phone version is 7.1.2 if that helps.

What process should I follow to find what the cause/s of the failure are?

Edit:

I am not using an _ or space in the project name.

Edit:

Error log for iPhone:

ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a file '/Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a' for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The error log for iPhone 4 64 bit simulator:

ld: warning: ignoring file /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a, missing required architecture x86_64 in file /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a (3 slices)
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_ZBarReaderViewController", referenced from:
      objc-class-ref in ViewController.o
  "_ZBarReaderControllerResults", referenced from:
      -[ViewController imagePickerController:didFinishPickingMediaWithInfo:] in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

(null): Ignoring file /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a, missing required architecture x86_64 in file /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a (3 slices)

(null): "_OBJC_CLASS_$_ZBarReaderViewController", referenced from:

(null): Objc-class-ref in ViewController.o

(null): "_ZBarReaderControllerResults", referenced from:

(null): -[ViewController imagePickerController:didFinishPickingMediaWithInfo:] in ViewController.o

(null): Symbol(s) not found for architecture x86_64

(null): Linker command failed with exit code 1 (use -v to see invocation)

Edit: I've got it to work fine on the iPhone by downloading and using the latest zbar sdk framework. Now however the simulator doesn't build as it wants the old one!

Anyone have an idea how to make both the phone and simulator happy?

Edit 2:

I got it working use the old libraries, but not the latest which is what I have to do for work. For the old libraries I did the following:

1) Create a new app and make it universal. 2) Follow the normal tutorial steps except use a storyboard not a xib file and set the project to use that for both iphone and ipad. Also don't put in the code near the end of the tute which specifies which Xib to use since I'm not using one! 3) In build settings set the Architectures and Valid Architectures to "armv7" 4) In build settings set Build Active architecture only to YES

What I've done just recently is to remove the old ZBar libraries and replace them which these http://www.nerdvision.net/app-development/ios/zbar-sdk

It gives me this error though:

ld: warning: ignoring file /blahblah/BarcodeScannerNew/BarcodeScannerNew/zbar_iOS7_Fix/libzbar.a, missing required architecture i386 in file /blahblah/BarcodeScannerNew/BarcodeScannerNew/zbar_iOS7_Fix/libzbar.a (3 slices)

Undefined symbols for architecture i386:

  "_OBJC_CLASS_$_ZBarReaderViewController", referenced from:

      objc-class-ref in AACsViewController.o

  "_ZBarReaderControllerResults", referenced from:

      -[AACsViewController imagePickerController:didFinishPickingMediaWithInfo:] in AACsViewController.o

ld: symbol(s) not found for architecture i386



clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think what that means is it wants the old (I presume 32 bit) libraries, not the latest ones. Not sure how to fix it though as I can't include both old and new Zbar files because it gives an error about duplicate files.

Doesn't look like ZBar is supported on iOS7. Last update was around iOS4 since when a lot has changed.

Source ZBar FAQ

Error says that zBar library isn't compiled for 64-bit simulators. So you'd either build library from sources with this support or wait for somebody to do it. Or just don't use 64-bit simulator for this. :)

This answer may help you to get this working on 64-bit simulator.

Also if you can support only iOS 7+, you can use system built-in code scanning capabilities.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM