李江淮
李江淮

Reputation: 43

iOS10 NSURLSession HTTP/2 Invalid

NSURLSession Request HTTP/2.0

working in iOS9.

enter image description here

but invalid in iOS10

enter image description here

my code :

 

    NSURLSession *session = [NSURLSession sharedSession];
    request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://ga.seeyouyima.com/page"]];
    [request setHTTPMethod:@"POST"];
    [[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        if (completedBlock) {
            completedBlock(data, response, error);
        }
    }] resume];

Upvotes: 2

Views: 1149

Answers (1)

gototen
gototen

Reputation: 138

It looks like Charles Proxy 4 will cause iOS 10 to not use HTTP/2. It seems to work fine with iOS 9.

You can demonstrate this by loading the Akamai HTTP/2 demo in Mobile Safari in iOS 10:

https://http2.akamai.com/demo

If you enable Charles Proxy while visiting the site it will report to you that your browser does not support HTTP/2.

Upvotes: 9

Related Questions