You declared RootViewController as a direct class declaration in the .h file using the @Class directive, but you did not import RootViewController.h into the ADBanner.mm file.
This means that the compiler knows that there is some class RootViewController , but no longer knows about it - its superclass, methods or properties. Thus, it cannot confirm that it actually has a layoutIfNeeded method.
Adding #import "RootViewController.h" to the beginning of ADBanner.mm will provide the compiler with the information it needs and fix the error.
source share