API violation when using waitForExpectations API violation when using waitForExpectations ios ios

API violation when using waitForExpectations


Ok, your mistake is that you try to instantiate the expectation directly. The docs clearly say

Use the following XCTestCase methods to create XCTestExpectation instances:
- expectation(description:)

This means, that you should create expectations like this :

func testMethod() {    let exp = self.expectation(description: "myExpectation")    // your test code}


matomo