0

Question 1:

I am trying to use this D3 example in Xcode. I have my UIWebView set up and working well, but the Javascript is not. I believe it has something to do with the code referencing files on the server on which it was hosted. How can I reference the files with Javascript inside Xcode? More specifically, what filepath should I use?

For example, The main.html file references a certain D3.chart.js by saying require ['d3.chart.js'], will this work in Xcode?

67cherries
  • 6,931
  • 7
  • 35
  • 51

1 Answers1

1

If your JavaScript files are hosted somewhere you'd simply point at that location, just like on any other web page. If though you're bundling the JS with your app, you'll want to included them by adding a copy files build phase. At that point you can load them using fileURLWithPath as suggested here.

Community
  • 1
  • 1
Madbreaks
  • 19,094
  • 7
  • 58
  • 72