在向XCode 5项目添加测试时会产生麻烦

 oyy8610406 发布于 2023-02-07 21:50

我觉得是时候为我的iPhone应用程序编写一些测试了.不幸的是,这并不顺利.我创建了一个新的测试类但是得到了下面的错误.看起来它正在向我提供OS X库但我不知道为什么......

Ld /Users/philswenson/Library/Developer/Xcode/DerivedData/3rdRevolution-crkklmdwurdjtrbjvjedcqqeoyvk/Build/Products/Debug-iphonesimulator/3rdRevolutionTests.octest/3rdRevolutionTests normal i386
cd /Users/philswenson/dev/3rdRev/3R_iOS
setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/philswenson/Library/Developer/Xcode/DerivedData/3rdRevolution-crkklmdwurdjtrbjvjedcqqeoyvk/Build/Products/Debug-iphonesimulator -F/Users/philswenson/Library/Developer/Xcode/DerivedData/3rdRevolution-crkklmdwurdjtrbjvjedcqqeoyvk/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/philswenson/Library/Developer/Xcode/DerivedData/3rdRevolution-crkklmdwurdjtrbjvjedcqqeoyvk/Build/Intermediates/3rdRevolution.build/Debug-iphonesimulator/3rdRevolutionTests.build/Objects-normal/i386/3rdRevolutionTests.LinkFileList -bundle_loader /Users/philswenson/Library/Developer/Xcode/DerivedData/3rdRevolution-crkklmdwurdjtrbjvjedcqqeoyvk/Build/Products/Debug-iphonesimulator/3rdRevolution.app/3rdRevolution -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -framework SenTestingKit -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/philswenson/Library/Developer/Xcode/DerivedData/3rdRevolution-crkklmdwurdjtrbjvjedcqqeoyvk/Build/Intermediates/3rdRevolution.build/Debug-iphonesimulator/3rdRevolutionTests.build/Objects-normal/i386/3rdRevolutionTests_dependency_info.dat -o /Users/philswenson/Library/Developer/Xcode/DerivedData/3rdRevolution-crkklmdwurdjtrbjvjedcqqeoyvk/Build/Products/Debug-iphonesimulator/3rdRevolutionTests.octest/3rdRevolutionTests

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_XCTestCase", referenced from:
      _OBJC_CLASS_$_IsoDateTest in IsoDateTest.o
  "_OBJC_METACLASS_$_XCTestCase", referenced from:
      _OBJC_METACLASS_$_IsoDateTest in IsoDateTest.o
  "__XCTFailureFormat", referenced from:
      -[IsoDateTest testExample] in IsoDateTest.o
  "__XCTFailureHandler", referenced from:
      -[IsoDateTest testExample] in IsoDateTest.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

这是我的框架搜索路径设置的屏幕截图: http://cl.ly/T7gV

有想法该怎么解决这个吗?

1 个回答
  • 从阅读"我决定是时候写一些测试",我猜你已经有一段时间了,因为你创建了这个项目.也许......

    您使用Xcode 4创建了项目.测试目标将使用SenTestingKit.

    您使用Xcode 5添加了IsoDateTest.m.最新的文件模板使用XCTest.

    检查测试目标的构建设置下的库列表.用XCTest.framework替换SenTestingKit.framework.

    2023-02-07 22:02 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有