• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Intercepting spawned URL requests from UIWebView and caching the response
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Intercepting spawned URL requests from UIWebView and caching the response


  • Subject: Re: Intercepting spawned URL requests from UIWebView and caching the response
  • From: 尹佳冀 <email@hidden>
  • Date: Thu, 21 Jun 2012 09:41:12 +0800

Hi, BareFeetWare

     NSURLProtocol is also can be used in iOS cocoatouch, you can check
this example
http://code.google.com/p/tkawebview/downloads/detail?name=tkaurlprotocol.zip&can=2&q=

this is a open source url protocol, but still have some bug,
1.  however I think you can use + requestIsCacheEquivalent:toRequest: to
check which resource to get from cache and which to start a new request
2. if you want get the resource requested by UIWebView, you can override
the UIWebView method   like this link
http://stackoverflow.com/questions/3155359/in-webkit-how-do-i-get-the-content-of-a-resourcemetioned
- (NSURLRequest*) webView:(WebView*)sender
                 resource:(id)identifier

          willSendRequest:(NSURLRequest*)request

         redirectResponse:(NSURLResponse*)redirectResponse

           fromDataSource:(WebDataSource*)dataSource
and if you want make all thing more safe, you can check this link
http://stackoverflow.com/questions/1637604/method-swizzle-on-iphone-device

2012/6/21 BareFeetWare <email@hidden>

> > On Cocoa, You can intercept the WebView requests using a custom
> NSURLProtocol. There is a fairly complete example here:
> >
> >
> http://stackoverflow.com/questions/3155359/in-webkit-how-do-i-get-the-content-of-a-resource
>
> Hi Jason,
>
> Thanks for your answer. Unfortunately, as you probably know, this doesn't
> help for my UIWebView on CocoaTouch (iOS).
>
> Thanks,
> Tom
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>



--
Fykec Yin
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Intercepting spawned URL requests from UIWebView and caching the response (From: Jason Perkins <email@hidden>)

  • Prev by Date: Re: Intercepting spawned URL requests from UIWebView and caching the response
  • Next by Date: Drag and drop issue - CoreDragGetMouseLocation
  • Previous by thread: Re: Intercepting spawned URL requests from UIWebView and caching the response
  • Next by thread: Drag and drop issue - CoreDragGetMouseLocation
  • Index(es):
    • Date
    • Thread