Linker error comes while running as well as testing the Xcode workspace after updating KIF framework via cocoapods

别来无恙 提交于 2019-12-23 10:22:02

问题


I have an Xcode workspace in which I have updated to KIF 2.0(pod update via terminal & pod 'KIF' in the podfile) after that I have configured the workspace as per the instructions provided in https://github.com/kif-framework/KIF#configure-the-testing-target(installation with Cocoapods section).But when I tried to execute the project as well as Run my test target it throws an error,

ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have also checked this link:https://groups.google.com/forum/#!msg/kif-framework/EilvCp2psZA/huUQ3sGpmwQJ . But still the issue persists.

How can I correct it? The screen shot is provided below.

When I tried to Run it using iPhone 5 it shows 5 linker error such as

ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit, missing required architecture armv7s in file /Applications/Xcode.app/Contents/Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit (2 slices)
Undefined symbols for architecture armv7s:
  "_OBJC_METACLASS_$_SenTestCase", referenced from:
      _OBJC_METACLASS_$_KIFTestCase in libPods.a(KIFTestCase.o)
  "_OBJC_CLASS_$_SenTestCase", referenced from:
      _OBJC_CLASS_$_KIFTestCase in libPods.a(KIFTestCase.o)
      l_OBJC_$_CATEGORY_SenTestCase_$_KIFAdditions in libPods.a(SenTestCase-KIFAdditions.o)
  "_SenTestToolKey", referenced from:
      +[KIFTestActor load] in libPods.a(KIFTestActor.o)
  "_SenSelfTestMain", referenced from:
      +[KIFTestActor load] in libPods.a(KIFTestActor.o)
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)


回答1:


Same issue here with the latest cocoa pods version.

You can solve this by following this steps:

  • Select the Pods project
  • Click on build settings
  • Change Build Active Architecture Only to 'No'



回答2:


Go to your target settings and add SenTestingKit to Link binary with libraries.




回答3:


It worked for me to remove the XCTest framework. I know that might be something you don't want to do though.




回答4:


I have solved the problem with the help of my colleague. Two steps: 1、just update the cocoapods to 0.29.0,because 0.29.0 just fix a bug,more detail ,see: https://github.com/CocoaPods/CocoaPods/issues/1558 use command: sudo gem install cocoapods pod install pod update 2、if you want run your app on ios devices,just change the Build Settings->Architectures,the value of it to (Standard Architecture (armv7,armv7s)),



来源:https://stackoverflow.com/questions/19782801/linker-error-comes-while-running-as-well-as-testing-the-xcode-workspace-after-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!