JQuery not loading on the iPhone

iphonejqueryuiwebviewwebkit

I'm trying to use a UIWebView to display content, and jQuery to manipulate that content, but I can't get jQuery to load. Here's the code that I have setting up the UIWebView, setting the baseURL, and loading the content (an HTML file that's in the local bundle):

UIWebView *view = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];

NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];

NSData *htmlData = [[NSData alloc] initWithContentsOfURL: [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]]];
NSString *htmlString = [[NSString alloc] initWithData:htmlData encoding:NSUTF8StringEncoding];
[view loadHTMLString:htmlString baseURL:baseURL];

The content loads just fine, and I've confirmed that the baseURL is correct by adding an image to the bundle and referencing it in the HTML, and it works. Using the same HTML in Safari on my Macbook jQuery is loading just fine, too, and working as expected.

I've tried both using the compressed jquery-1.3.2.min.js and the development jquery-1.3.2.js, and no dice for either.

Any ideas?

Best Answer

Gah! EBCAK!

Turns out when I copied the jquery javascript source into the project, it was copied into the target's "Compile Sources," which of course threw errors. I deleted it from "Compile Sources" but didn't add it back to "Copy Bundle Resources."

/me slaps forehead repeatedly.