Avoid view is not in the window hierarchy error on iOS8