ARC, bridge cast and GHUnit

I follow the instructions from http://gabriel.github.com/gh-unit/docs/appledoc_include/guide_testing.html . The problem is that my project uses ARC, but GHUnit does not. I dealt with the previous errors, but now I need to do a bridge translation, which I never used, and I'm lost.

NSString *string1 = @"a string"; GHAssertNotNULL(string1, nil); //error here 

Error description: Implicit conversion of the Objective-C pointer type 'NSString *' to the C-pointer type 'const void *' requires bridge migration.

Any help is appreciated :)

+7
source share
2 answers

Since you are comparing NSString, you should use the GHAssertNotNil check. See NULL vs nil in Objective-C for more details.

So your example should look like this:

 NSString *string1 = @"a string"; GHAssertNotNil(string1, nil); 

I also noticed in my ARC projects using GHUnit that the GHUnit main.m file requires

 -fno-objc-arc 

linker flag, as suggested earlier.

+11
source

You can exclude only GHUnit files from automation links (ARC) from your project by entering Build Phase → Compilation Sources

and then double-click the files from GHUnit, a window will appear, paste the following into it

 -fno-objc-arc 

This excludes files from GHUnit from references to automatic systems (ARC).

+1
source

All Articles