問題描述
我有一個 Web 服務(wù)調(diào)用實時對用戶輸入執(zhí)行一些驗證.我想在驗證中使用 [NSURLConnection sendAsynchronousRequest]
(在 iOS 5 中引入),但如果用戶同時更改輸入字段內(nèi)容,請取消它.取消當(dāng)前請求的最佳方法是什么?
I've got a web service call performing some validation on user input in real time. I'd like to use [NSURLConnection sendAsynchronousRequest]
on the validation (which was introduced in iOS 5), but cancel it if the user changes the input field content in the mean time. What is the best way to cancel a current request?
推薦答案
似乎沒有什么好的方法可以做到這一點.解決方案似乎是在需要取消請求的情況下不使用新的 [NSURLConnection sendAsynchronousRequest]
.
It doesn't appear that there is a good way to do this. The solution seems to be to not use the new [NSURLConnection sendAsynchronousRequest]
in situations in which you need to cancel the request.
這篇關(guān)于如何通過 NSURLConnection sendAsynchronousRequest 取消異步調(diào)用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!