implementing timeout solution for iOS