raphaeljs and iPhone: not working when embedded in bundle?
I cannot get Raphaël working in a UIWebView.
I load a simple HTML-Webpage with this content:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page Title</title>
<script src="js/lib/raphael-min.js" type="text/javascript" charset="utf-8"></script>
<s开发者_如何学Gocript type="text/javascript" charset="utf-8">
alert("" + Raphael);
</script>
</head>
<body>
</body>
</html>
If I open this page with Safari on the simulator, I get an alert with some version information.
When I start the app and load the HTML, I do not get an alert, which indicates some JavaScript-Error - but I cannot read it because UIWebView does not have an output for that.
Can anyone reproduce this problem?
Has anyone an idea why this might happen? Help is greatly appreciated.
The problem was that .js
-files often get into the "Compile" phase of your target, and not into the "Copy bundle items" phase where they should reside.
I had similar problems but was using "loadHTMLfromString"
[Web loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]];
精彩评论