• Stars
    star
    663
  • Rank 67,991 (Top 2 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 8 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Make your WKWebView happy with NSURLProtocol

NSURLProtocol+WebKitSupport

Note:If you target iOS 11, you can now use WKURLSchemeHandler to avoid this trick! 😆

让 WKWebView 支持 NSURLProtocol

This example project shows a way to use NSURLProtocol with WKWebView, which was not possible before.

Screenshot

Usage

Drag NSURLProtocol+WebKitSupport.h and NSURLProtocol+WebKitSupport.m into your project, then register the scheme for NSURLProtocol to handle:

[NSURLProtocol wk_registerScheme:@"https"];

// You can now use your own NSURLProtocol subclasses as before.
[NSURLProtocol registerClass:[MyAwesomeURLProtocol class]];

To remove the scheme from registery:

[NSURLProtocol wk_unregisterScheme:@"https"];

Note

This category uses undocumented APIs in WebKit. Use at your own risk.