开发者

How to filter out duplicate requests in UIWebView

I am writing an iPhone app that integrates with Foursquare via OAuth. I am able to log in, obtain an access token, and use the API endpoints. I do the log in with a UIWebView.

The problem is that for every tap on the web view (Login, Allow, etc.), two identical requests are made. So when I dismiss the web view after obtaining an access token, the web view's didFailLoadWith开发者_StackOverflow社区Error: message fires, presumably for the second (duplicate) request. This is causing crashes and unwanted behavior.

Is there any way I can prevent the duplicate requests from happening or can I 'filter' them out?


fa solution for filtering out: You can set the delegate-property of UIWebView to nil before dismissing it.

self.myWebView.delegate = nil;
self.myWebView = nil; //retain-property

edit: but this will not really prevent the UIWebView to send the second request over the wire. This will only end up with not being notified twice. You have to discover why the second request is sent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜