Farhan Ahmad
Farhan Ahmad

Reputation: 5198

NSURL URLWithString not working properly in iOS7

I am experiencing very strange behaviour with NSURL URLWithString.

I am trying to load a webview with the following code:

/* DOES NOT WORK */ NSURL *targetURL = [NSURL URLWithString:@"http://njs1.example.com:3000/assets/0/2147484153/642/645/77b9430e-bde8-4284-af7d-300b3474eeb9.pdf"];
/* WORKS! */ NSURL *targetURL = [NSURL URLWithString:@"http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIWebView_Class/UIWebView_Class.pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
[self.view addSubview:webView];

It does not work when I try to load the following URL:

http://njs1.example.com:3000/assets/0/2147484153/642/645/77b9430e-bde8-4284-af7d-300b3474eeb9.pdf

NOTE: The link above is generated on request by the server with customer headers.

It works when I load the following URL:

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIWebView_Class/UIWebView_Class.pdf

The code above works fine in iOS 5 and iOS 6 but not in iOS 7. Does anyone know why it's doing this?

Upvotes: 2

Views: 525

Answers (1)

David Snabel-Caunt
David Snabel-Caunt

Reputation: 58361

Your response headers are severely malformed, according to Chrome's developer tools

Network inspector

Upvotes: 2

Related Questions