XCode 4.3 - Build error “missing required architec

2019-02-09 15:28发布

问题:

After upgrade XCode from 4.2 to 4.3 I've got below problem. I can't build it. Do you guys have idea how can I resolve this problem? even some clue would be helpful to me.

ld: warning: ignoring file    /Applications/Xcode.app/Contents/Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit, missing required architecture armv7 in file
Undefined symbols for architecture armv7:
  "_STComposeString", referenced from:
      -[NSMutableURLRequest_ParametersTest verifyDefaultParametersForRequest:] in NSMutableURLRequest+ParametersTest.o
      -[NSMutableURLRequest_ParametersTest verifyModifiedParametersForRequest:] in NSMutableURLRequest+ParametersTest.o
      -[NSMutableURLRequest_ParametersTest verifyEmptyParametersForRequest:] in NSMutableURLRequest+ParametersTest.o
      -[NSString_URLEncodingTest testURLEncodedString] in NSString+URLEncodingTest.o
      -[NSURL_BaseTest testURLStringWithoutQuery] in NSURL+BaseTest.o
      -[OAHMAC_SHA1SignatureProviderTest testSignClearText] in OAHMAC_SHA1SignatureProviderTest.o
      -[OAMutableURLRequestTest testGenerateNonce] in OAMutableURLRequestTest.o
      ...
  "_OBJC_CLASS_$_SenTestCase", referenced from:
      _OBJC_CLASS_$_NSMutableURLRequest_ParametersTest in NSMutableURLRequest+ParametersTest.o
      _OBJC_CLASS_$_NSString_URLEncodingTest in NSString+URLEncodingTest.o
      _OBJC_CLASS_$_NSURL_BaseTest in NSURL+BaseTest.o
      _OBJC_CLASS_$_OAHMAC_SHA1SignatureProviderTest in OAHMAC_SHA1SignatureProviderTest.o
      _OBJC_CLASS_$_OAMutableURLRequestTest in OAMutableURLRequestTest.o
      _OBJC_CLASS_$_OAPlaintextSignatureProviderTest in OAPlaintextSignatureProviderTest.o
      _OBJC_CLASS_$_OARequestParameterTest in OARequestParameterTest.o
      ...
  "_OBJC_METACLASS_$_SenTestCase", referenced from:
      _OBJC_METACLASS_$_NSMutableURLRequest_ParametersTest in NSMutableURLRequest+ParametersTest.o
      _OBJC_METACLASS_$_NSString_URLEncodingTest in NSString+URLEncodingTest.o
      _OBJC_METACLASS_$_NSURL_BaseTest in NSURL+BaseTest.o
      _OBJC_METACLASS_$_OAHMAC_SHA1SignatureProviderTest in OAHMAC_SHA1SignatureProviderTest.o
      _OBJC_METACLASS_$_OAMutableURLRequestTest in OAMutableURLRequestTest.o
      _OBJC_METACLASS_$_OAPlaintextSignatureProviderTest in OAPlaintextSignatureProviderTest.o
      _OBJC_METACLASS_$_OARequestParameterTest in OARequestParameterTest.o
      ...
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

回答1:

I was getting the same linking error for the Simulator after upgrading from Xcode 4.2 -> 4.3.1. I noticed that new projects in 4.3.1 do work with Unit Tests, so just compared the project differences.

What fixed it for me was:-

  1. Select Project in project navigator
  2. Select Test Target
  3. Select Build Settings
  4. Go down to Framework Search Paths and single-click it
  5. Delete whatever is there
  6. Enter $(SDKROOT)/Developer/Library/Frameworks $(DEVELOPER_LIBRARY_DIR)/Frameworks
  7. If you had any custom frameworks, add those back

Actually, Unit Tests run fine on the Device, too.



回答2:

Looks like this was either an accidental (or on purpose) omission on Apple's part.

If (and only if) you are a registered Apple Developer, you can log into the Apple Developer Forums and if you copy this linked search query into your browser address bar, you will see other people have had the same problem.

For now, it looks like you can only use SenTestingKit on the simulator.



回答3:

I had a similar issue with Xcode 4.4. My solution path: Removed SetTestingKit.framework from the main target's (the system under test) "link binary with libraries", leaving it in the test target as is. Not sure why it ended up there in the first place.



回答4:

I believe this bug is now fixed in Xcode 4.4.1



回答5:

Using xcode 4.6 and trying to add facebook SDK 3.1 I had this problem because I didn't select to add the files to my test target.

You should check both targets when you copy the framework.



回答6:

I just upgraded to 4.3.1 There is a problem with SenTestingKit framework. I removed the test source code from the project, it builds ok. And it can run on 5.1 device. But I got _dyld_dyld_start error when I ran it on simulator. I had to remove SenTestingKit from the project to make it work on simulator.



标签: xcode4