码迷,mamicode.com
首页 > 其他好文 > 详细

OC 单元测试学习笔记

时间:2016-12-25 01:30:52      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:clang   loader   测试   fragment   doc   types   led   can   dev   

UnitTest 编译异常汇总:

问题1

Check dependencies

No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).

经过与正常 test target 设置比较,默认设置中 Debug architecture 只有armv7 添加 arm64以后 Test build 即成功;

问题2

ld: -bundle_loader can only be used with -bundle

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

Mach-O mac OS 上的可执行文件格式,在xcode help 文档中,具体是这样描述的,测试target 需选择 Bundle

问题3

test target 碰到如下错误:

 ld: entry point (_main) undefined. for architecture armv7

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

 

在test target 中 , General Tab, 把 Allow testing Host Application APIs 复选框勾上即解决了此问题。

 

附录:

Mach-O Type (MACH_O_TYPE)

This setting determines the format of the produced binary and how it can be linked when building other binaries. For information on binary types, see Building Mach-O Files in Mach-O Programming Topics.

  • Executable: Executables and standalone binaries and cannot be linked. mh_execute
  • Dynamic Library: Dynamic libraries are linked at build time and loaded automatically when needed. mh_dylib
  • Bundle: Bundle libraries are loaded explicitly at run time. mh_bundle
  • Static Library: Static libraries are linked at build time and loaded at execution time. staticlib
  • Relocatable Object File: Object files are single-module files that are linked at build time. mh_object

OC 单元测试学习笔记

标签:clang   loader   测试   fragment   doc   types   led   can   dev   

原文地址:http://www.cnblogs.com/monster1799/p/6218753.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!