fix bug of portrait crash in ios