WeyCell
WeyCell

Reputation: 283

NSURLProtocol canInitWithRequest calling 5 times

I'm working on a hybrid application framework. I needed to catch all request from somewhere and i fond some blog it says i can do that with using custom NSURLProtocol. I did everything it says but i have some problems.

When i load http://www.google.com to my webview, it calls canInitWithRequest for 5 times in mycustomprotocol.m. but i dont want to call 5 times.

  1. 2014-03-13 15:51:50.675 Hybrid[9334:60b] http://www.google.com/
  2. 2014-03-13 15:51:50.677 Hybrid[9334:60b] http://www.google.com/
  3. 2014-03-13 15:51:50.683 Hybrid[9334:60b] http://www.google.com/
  4. 2014-03-13 15:51:50.685 Hybrid[9334:60b] http://www.google.com/
  5. 2014-03-13 15:51:50.686 Hybrid[9334:60b] http://www.google.com/
  6. 2014-03-13 15:51:54.474 Hybrid[9334:3807] http://www.google.com/
  7. 2014-03-13 15:51:54.508 Hybrid[9334:3807] http://www.google.com/images/logo_ret_2.png
  8. 2014-03-13 15:51:54.509 Hybrid[9334:3807] http://www.google.com/images/logo_ret_2.png
  9. 2014-03-13 15:51:54.510 Hybrid[9334:3807] http://www.google.com/images/logo_ret_2.png

I only loaded google for once. Why is canInitWithRequest calling five times before startLoading? Please Help!

Upvotes: 0

Views: 493

Answers (1)

iOSMonkey
iOSMonkey

Reputation: 119

Same question is answered here >

NSURLProtocol canInitWithRequest: called multiple times

Its said to be normal behaviour

Upvotes: 2

Related Questions