Viv*_*ive 7 objective-c gh-unit automatic-ref-counting
我正在关注http://gabriel.github.com/gh-unit/docs/appledoc_include/guide_testing.html上的教程.问题是我的项目使用ARC而GHUnit没有.我管理过以前的错误,但现在我应该做桥接演员,我从未使用过,而且我迷路了.
NSString *string1 = @"a string";
GHAssertNotNULL(string1, nil); //error here
Run Code Online (Sandbox Code Playgroud)
错误描述:将Objective-C指针类型'NSString*'隐式转换为C指针类型'const void*'需要桥接转换.
任何帮助欢迎:)
jos*_*ine 11
由于您要比较NSString,因此应使用GHAssertNotNil检查.有关详细信息,请参阅Objective-C中的NULL与nil.
所以你的例子应该是:
NSString *string1 = @"a string";
GHAssertNotNil(string1, nil);
Run Code Online (Sandbox Code Playgroud)
我在使用GHUnit的ARC项目中也注意到GHUnit main.m文件需要
-fno-objc-arc
Run Code Online (Sandbox Code Playgroud)
如前所述,链接器标志.
| 归档时间: |
|
| 查看次数: |
1605 次 |
| 最近记录: |