How to remove subwindow(pop up, ads) which appears randomly on IOS app

I handle the same issue in android using the concept of thread and AndroidDriver.curentActivity method but in ios I get blocked as IOS apps have view controller instead of Activity…Please assist