Cronet takes advantage of multiple technologies that reduce the latency and increase the throughput of the network requests that your app needs to work.
This is the same networking stack that is used in the Chrome browser by over a billion people. Cronet has support for both Android and iOS.
This package makes it easy to use Cronet in your iOS apps.
Note: You will have to disable bitcode on your target.
Cronet natively supports the HTTP, HTTP/2, and QUIC protocols.
The library allows you to set a priority tag for the requests. The server can use the priority tag to determine the order in which to handle the requests.
Cronet can use an in-memory or disk cache to store resources retrieved in network requests. Subsequent requests are served from the cache automatically.
Network requests issued using the Cronet Library are asynchronous by default. Your worker threads aren't blocked while waiting for the request to come back.
Cronet supports data compression using the Brotli Compressed Data Format.
You may be wondering, if Cronet is a chromium libary, what is this repo about?
That is right, Cronet is a chromium library and this repo doesn't add or modify any chromium code. For that fact this repo doesn't even have any code. This repo is about making Cronet easier to use in your iOS app if you are not a google employee.
As some one of HN succiently said:
Chromium is a fairly typical google project where the recommended first step to building it is to become a google employee but some alternative workarounds are also available if that's not practical.
More precisely this repo:
lipofor both static and dynamic builds
Cronet.frameworkinto your iOS app's workspace/project either using
cocoapodsor manually linking the framework.
pod 'Cronet'under your desired target in your
Cronet.framewrokfolder into your project by dragging the folder into your project in Xcode. Make sure to select Copy items if needed in the dialog that pops up
Link Binary With Librariesadd
Other Linker Flagsadd
Initialize cronet somewhere in your app's start flow. For example, in:
- (BOOL)application:... didFinishLaunchingWithOptions:...
[Cronet setHttp2Enabled:YES]; [Cronet setQuicEnabled:YES]; [Cronet setBrotliEnabled:YES]; [Cronet start]; [Cronet registerHttpProtocolHandler];
For a complete list of initilization options see Cronet.h
NSURLSession*Delegatecallback's don't work when cronet is registered as a protocol handler in that session.
See the LICENSE file for more info.