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

6
  • Hi john I am also facing the same issue. My code is working like this <script type="text/javascript" src="jquery-1.6.2.min.js"></script> but in other other cases except iOS development we give relative path of js not the only name. Can you explain this Commented Jan 15, 2014 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 Commented Jan 16, 2014 at 3:22
  • Oh and just the name is the relative path to 'same folder as this file is in' right? Commented Jan 16, 2014 at 3: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. Commented Jan 16, 2014 at 6: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. Commented Dec 21, 2016 at 13:37

1 Answer 1

1

Answered fully at the top of the Question

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.