I am trying to create unit tests using the new XCTest framework introduced in Xcode 5. I have a line in one of my test cases that looks like this:
XCTAssertEqual([self.client stringEncoding], NSUTF8StringEncoding, …);
When I try to run my tests, Xcode spits out this error: "Reference to NSUTF8StringEncoding is ambiguous." I can get the test to work by changing the above line to this:
XCTAssertEqual([self.client stringEncoding], (NSStringEncoding) 4, …);
(This works because 4 is the value of NSUTF8StringEncoding
.) This also happens when I assign NSUTF8StringEncoding
to a local variable and use it in the XCTAssertEqual()
call instead. Why am I getting this error?