我使用以下代码来调用UITableView
-(void)testJumpSection
{
NSIndexPath *indexPath1= [NSIndexPath indexPathForRow:0 inSection:0];
[viewControllerObject tableView:viewControllerObject.masterTableView didSelectRowAtIndexPath:indexPath1];
int backButtonSection = viewControllerObject.backButtonSection;
NSIndexPath *indexPath2= [NSIndexPath indexPathForRow:0 inSection:2];
[viewControllerObject tableView:viewControllerObject.masterTableView didSelectRowAtIndexPath:indexPath2];
int backButtonSection2 = viewControllerObject.backButtonSection;
[viewControllerObject backButtonView:viewControllerObject.button1];
int backButtonSectionTestValue = viewControllerObject.backButtonSection;
STAssertTrue(backButtonSectionTestValue==1, @"TestJumpSection");
}
我正在为扩展/折叠uitableview编写此测试用例。当用户单击第0部分的行然后单击第3部分时。可能会点击后退按钮以导航部分2.现在我必须得到结果backButtonsection值减1。
工作正常,但我无法获取所选的部分值,我收到此错误:
[__ NSCFConstantString stringByAppendingString:]:nil参数“
关于我做错了什么的任何想法?
答案 0 :(得分:0)
很明显,您在stringByAppendingString:
上调用__NSCFConstantString
,其参数为nil
。
一个简单的例子会导致这个问题
[@"some string" stringByAppendingString:nil];
更可能的原因是
NSString *str;
str = @"some string"
NSString *anotherStr = nil;
// some other code that should set anotherStr but did not
NSString *result = [str stringByAppendingString:anotherStr]; // error
所以去查找stringByAppendingString:
并检查他们的论点