views:

99

answers:

1

I've encountered a strange problem, when it comes to displaying a page in a UIWebView on iPhone SDK 4.0.

I load a page with a .aspx-request and receive completely valid html-sourcecode. Inside the html is an email-address linked like this:

<a href="mailto:[email protected]">[email protected]</a><br />

When I activate the link-detection in the UIWebView, I got an exception:

-[DOMHTMLElement setHref:]: unrecognized selector sent to instance 0x5a6dc70
2010-07-26 16:13:09.292 MyApp[23818:2103] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DOMHTMLElement setHref:]: unrecognized selector sent to instance 0x5a6dc70'

Now what is strange about this issue? When I take exactly the same html-sourcecode, that is returned by the request, save it locally to a .html-file and load it from there with UIWebKit, everything works like a charm like it should. Anyone got an idea, why this is the case?

Btw: I create the request like that in the source-code:

NSURL* url = [NSURL URLWithString:@"http://my.tld.com/path/site.aspx"];
// alternate request: this works!
//NSURL* url = [NSURL URLWithString:@"file:///Users/user/Desktop/site.html"]; 

NSURLRequest* request = [NSURLRequest requestWithURL:url];

myWebView.delegate = self;
[myWebView loadRequest:request];
A: 

Are you 100% certain that the contents of your static "site.html" file are exactly the same as what's returned by that .aspx page? It really doesn't make sense that the same data would give you different results when loading it from an http: URL vs. a file: one.

If you haven't already, try downloading the .apsx version by doing something like:

curl http://my.tld.com/path/site.aspx > site.html

and test using the downloaded version.

David Gelhar
Thanks for your answer. I tried this - with the same result. The source is identical, and with the .html from the local filesystem it just works. This is why this issue is so stange. Maybe it's got something to do with the .aspx / .html filetype? Maybe I should try – loadData:MIMEType:textEncodingName:baseURL:, instead of - loadRequest in the UIWebView?
nodepond
Uh, I also send the server-reply from the .aspx-request to the iPhone debugger-console: it is just the same source!
nodepond