This exception is being raised in your own code.
Looking at the KIF source, insertObject:atIndex:
is called in two places: in addStep:
and in KIFTypist
.
Your exception is occurring in the execution of the step so it is not in addStep:
, and you are not using the keyboard methods so KIFTypist
isn't being used.
What is likely happening is that KIF is tapping the screen at that point, and your gesture recognizer or callback listener is triggering the exception. This would normally crash your app but KIF's exception handler caught it and reported the test failure. You can catch the exception where it is raised using a breakpoint exception and find out what caused it.
It is worth noting that screen coordinate 10, 10
is typically untappable because it is inside the status bar. To tap your app at 10, 10
you should pass 10, 30
.
Update
Per our discussion in the comments, the exception is being raised in windowsWithKeyWindow
where the key window was nil
. The only situation where keyWindow
would be nil
in typical apps is before you call [self.window makeKeyAndVisible]
in your app delegate. You need to make sure all setup logic (including making a key window) is done before you call KIF's startTestingWithCompletionBlock:
method.