This package makes it easy to use Chromium's networking stack in your iOS applications
Cronet is the Chromium network stack made available to iOS apps as a library.
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.
Protocol support
Cronet natively supports the HTTP, HTTP/2, and QUIC protocols.
Request prioritization
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.
Resource caching
Cronet can use an in-memory or disk cache to store resources retrieved in network requests. Subsequent requests are served from the cache automatically.
Asynchronous requests
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.
Data compression
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:
lipo
for both static and dynamic buildsCronet
with.Cronet.framework
into your iOS app's workspace/project either using cocoapods
or manually linking the framework.pod 'Cronet'
under your desired target in your Podfile
:pod install
Cronet.framewrok
folder 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 upTarget
-> Build Phase
-> Link Binary With Libraries
add SystemConfiguration.framework
Target
-> Build Settings
-> Other Linker Flags
add -lc++
Initialize cronet somewhere in your app's start flow. For example, in:
- (BOOL)application:... didFinishLaunchingWithOptions:...
Add:
[Cronet setHttp2Enabled:YES];
[Cronet setQuicEnabled:YES];
[Cronet setBrotliEnabled:YES];
[Cronet start];
[Cronet registerHttpProtocolHandler];
For a complete list of initilization options see Cronet.h
NSURLSession*Delegate
callback's don't work when cronet is registered as a protocol handler in that session.See the LICENSE file for more info.