9

------------------NOTICE---------------- Sorry guys, made a stupid mistake, I had found this fix already: https://devforums.apple.com/message/32282

Which works, but didn't realise that the target location had changed in the newer versions of Xcode, so instead clicked on the project file at the top of the list on the left, and found my way to Copy Bundle Resources that way. Not sure why everything but the js shows up there by default, but dragging the files there from the list on the left fixed my problem!

I'm programming an app for ios in html in a uiwebview (a book app) and using jquery and touchwipe to use swipes to move back/forwards through pages.

My code works when I source the javascript like this in the html:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="http://www.netcu.de/templates/netcu/js/jquery.touchwipe.min.js"></script>

but doesn't work when I try to store the js locally, like this:

<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="jquery.touchwipe.min.js"></script>

The .js files are of course in the xcode project, next to the html files (which I suppose doesn't matter as everything is flattened when it's built)

Can anyone point me in the right direction? I'm using Xcode 4.2 on Mac OS 10.6.8

Jay
  • 902
  • 2
  • 12
  • 27
  • Hi john I am also facing the same issue. My code is working like this but in other other cases except iOS development we give relative path of js not the only name. Can you explain this – Dinesh Kaushik Jan 15 '14 at 10:00
  • In my case it was that the .js file hadn't been added to the project in the Copy Bundle Resources section in Target - Build Phases – Jay Jan 16 '14 at 03:22
  • Oh and just the name is the relative path to 'same folder as this file is in' right? – Jay Jan 16 '14 at 03:22
  • I already resolved my problem of relative path. You can add individual file to bundle (in this case use only file name). You can also add folders to the bundle (in this case use relative path). Anyways Thanks for the reply. – Dinesh Kaushik Jan 16 '14 at 06:11
  • @John Is there a way to make it work without adding jquery js into copy bundle sources, because I will download it and save it application directory and load the html in UIWebview when accessed from App. – nOOb iOS Dec 21 '16 at 13:37
  • I’m voting to close this question because the accepted answer refers to an answer in the question (rather than being an actual answer), and the answer in the question relies on a broken link. In short, this isn't a Q&A and can't help future readers. – outis Nov 04 '21 at 23:07

1 Answers1

1

Answered fully at the top of the Question

Jay
  • 902
  • 2
  • 12
  • 27