ios - Class is not key value coding-compliant for the key staticTexts -


i have error: xctasserttrue failed: throwing "[<xcelementsnapshot 0x7fea978b1a10> valueforundefinedkey:]: class not key value coding-compliant key statictexts."

here code:

let predicate = nspredicate(format: "(self.statictexts[%@].exists == true) , (self.statictexts[%@].exists == true)", message, namestring) xctassert(app.collectionviews.childrenmatchingtype(.cell).elementmatchingpredicate(predicate).exists) 

error thrown on second line.

i have looked @ other answers on same error, , it's caused having variable of different class, don't see possibility error here. also, checked see predicate formatted correctly.

how can rid of error?

make sure statictexts property dynamic or otherwise available objc (by marking @objc instance). swift not generate kvc-compliant accessors unless thinks needs to.

alternately, use other nspredicate here. making property dynamic when it's not needed has performance cost, why swift doesn't automatically. marking dynamic unit test can access may poor tradeoff.


Comments