UIWebView doesn't load external Javascript file

前端 未结 4 1352
臣服心动
臣服心动 2020-12-04 15:03

I have the following innocent-looking code (index.html), but it doesn\'t load the code.js file. It works well if I copy/paste the contents of the file in the HT

4条回答
  •  清歌不尽
    2020-12-04 15:22

    I have found that Xcode thinks that the js file needs to be compiled.

    Open the project in Xcode. Go to "Targets" and look in "Compile Sources". If you see your js file in that folder, move it to the "Copy Bundle Resources" folder and delete it from the "Compile Sources" folder.

    Delete the app from your iPhone if it is installed already for testing. Go to the Build menu in Xcode and Clean all Targets. Then recompile.

    Check now to see if your HTML file actually sees your js file now.

    Linda

提交回复
热议问题