Reference Information. I am developing an iPhone-type news reader application that displays many news articles as html in UIWebViews. My current goal is to have a css file in my project that can style html that is programmatically complex (article + comments, etc.). I made a bunch of small proofs of the concepts, and I know that I can use <link id=\"stylesheet\" rel=\"stylesheet\" href=\"Test.css\" type=\"text/css\" />loadHTMLString as part of the input line for the webview and achieve the result of the html simulation in the expected mode using the mainbundle pool path as the baseUrl input to this function. Unfortunately, this does not work when I do this in my actual project. Please note that my problem can be reproduced using simple html.
Here is the part where I scratch my head: I can use @ "as the base url and display the uninstalled html, as expected. But, if I use the bundlepath package as baseUrl instead, the UIWebView is empty. Next, the webViewDidStartLoad callback never hits the breakpoint (this happens with @ "). What can lead to the fact that it does not burn? Of the 4 callbacks, only one that fires is shouldStartLoadWithRequest, from which I return NO. The file didFailLoadWithError and webviewDidFinishLoad are two others.
My suspicion is that something must be wrong with the mainbundle, but I have no idea what.
I sometimes get this message in gdb, although this may be unrelated: void SendDelegateMessage (NSInvocation *): the delegate was unable to return after waiting 10 seconds. main launch mode: kCFRunLoopDefaultMode If you have not used the touch screen for this entire interval (which may extend this wait), please report an error.
Code snippets: Note: the css link does not actually affect this problem.
UIWebView* contentView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
contentView.delegate = self;
NSString *htmlString = @"<html><body>Hello World</body></html>";
NSString *path = [bundle bundlePath];
NSURL *resourceBaseURL = [NSURL fileURLWithPath:path];
[contentView loadHTMLString:htmlString baseURL:resourceBaseURL];
Values at load time of the HTMLString call:
htmlString: "<html><body>Hello World</body></html>"
resourceBaseUrl: file://localhost/Users/U0107552/Library/Application%20Support/iPhone%20Simulator/3.1.3/Applications/D0EE8DA9-B156-47B3-BC53-9A731F813FB1/Test%20App.app/
The only difference I can see between my working POC and my application is that gdb: po htmlString returns "[line above] Current language: auto; currently objective-c" in POC, but only a line in my application.
Sorry for the longevity.