Reputation: 1
I made a demo app with just a UITextField to enter URL and a UIWebview, trying to isolate the problem.
UIWebViewDelegate simply look like this:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
return YES;
}
And UITextFieldDelegate:
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
NSMutableURLRequest *requestObj = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", textField.text]]];
// [self.webview loadRequest:requestObj];
[self.webview loadRequest:requestObj progress:^(NSUInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {
} success:^NSString *(NSHTTPURLResponse *response, NSString *HTML) {
return HTML;
} failure:^(NSError *error) {
}];
[textField resignFirstResponder];
return YES;
}
I'm wondering why when I try to load www.pornhub.com with default method it works perfectly but with the AFNetworking category, it loads a weird design. Any idea of what's happening here?
Upvotes: 0
Views: 2606
Reputation: 19544
The requests are probably not equivalent. Less visible request information like User-Agent
, Accept
, or Content-Type
headers, or cookies can have unforeseen effects when interacting with a web service.
You can see what request information is going over the wire by using an HTTP proxy like Charles.
Upvotes: 1