Can I add a .js file to my resource bundle?

If I add a .js file to my resources for loading at runtime, it doesn't seem to work. If I rename the file with a .txt extension it is fine:
//this won't return a path to foo.js
NSString* path = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"js"];
//but this can find foo.txt
NSString* path = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"txt"];
Now, I can just use a .txt extension for the files I want to load, but I'm curious to know what's happening - I guess the build process is treating it as source code and discarding it, is there any way to add a .js to my resource bundle?

PaulDixon wrote:
I've verified it's not present by attempting to load it and failing as outlined in the original post.
That's not an entirely meaningful verification as it only proves your code is failing; not why. Open the bundle in the Finder and look.
Perhaps my question would be better phrases as +'How do I stop XCode from treating a .js file as source code and put it in the resource bundle instead'+
Anything you want in the bundle needs to be in the "Copy Bundle Resources" build phase for the target.

Similar Messages

  • How can I add an AVI file to iMovie?

    I have iMovie '11. It won't let me add a .AVI file. If I can't add a .AVI file what is the best FREE software to convert it and what should I convert it to? Thanks!

    I agree with the Streamclip suggestion for two reasons.
    The first is that it is free and works well.
    The second is that Streamclip is so essential that if one doesn't have it on one's computer, one is missing a very fascinating piece of software. Free, converts faster than anything Apple uses, and gives you a little window to see the conversion to make sure everything is going ok.
    Hugh

  • How can I add an audio file to each slide when I export to HTML Keynote 6.2

    How can I add an audio file to each slide when I export to HTML Keynote 6.2
    I am trying to create an audio slide show instead of a movie

    Drag and drop one music files onto each slide then export. (File > Export > HTML)

  • Can I add a favorites file on my I pad

    Can I add a favorites file on my I pad?

    What type of Favorites? 
    In Safari in another browser? 
    On the home screen?
    What exactly is it you want to do?
    You can find the Favorites folder in Safari by tapping the Bookmarks icon and then tapping on Favorites.

  • I can not add a wmv file to the library. It is not protected

    Can not add a video file to Itunes library and even when I try to open the video using "open with Itunes", Itunes start but instead of the video I see the music library

    iTunes cannot play nor convert WMV files. You'll need to use a third-party application to convert the video to a format iTunes can accept.
    http://support.apple.com/kb/HT2729
    Regards.

  • Can i add a *jpeg file to the text analytic

    Post Author: Ferhat
    CA Forum: Performance Management and Dashboards
    can i add a jpeg file or something like that (*bmp, *gif) ?
    is anyone know?
    thanks a lot.

    Post Author: saravkumar
    CA Forum: Performance Management and Dashboards
    Yes, you can add an image.  Try the following html script with your image.name:
    <img src="http://technicalsupport.businessobjects.com/images/netscape.gif" width="33" height="32">
    or
    <img src="http://www.businessobjects.com/images/ie.gif">

  • Can I Use a XML file as Managed Resource?

    Hi,
    I have a XML file which has all employee details.
    Can I use that XML file as a Resource in IDM?
    If so please let me know the steps to do.
    Please help me in this regard.
    Thanks
    RMS

    No.
    Since the XML file you have has custom tags, there is not a way for IDM to understand it's contents.
    IDM does offer a "Simulated" resource, which is an XML based resource, but it has a defined structure. You might be able to alter your XML to match what the Simulated Resource expects, or better yet, get it into a database and use the database table adapter.

  • How can I add my own files to the TV Shows Library instead of the Movie Library?

    I have my own TV Shows in m4v format.  I can drag and drop the TV Shows into the iTunes Movie Library.  How can I add my files to the TV Shows Library?  Can I group them by show in the TV Shows Library?

    Select the files in iTunes.
    Right click - get info.
    Select the Options tab and set Media kind to TV Show.
    Better yet, use something like MetaZ to tag the files before adding them to iTunes.
    -> http://www.macupdate.com/app/mac/36029/metaz

  • Can I add a lossless file to my itunes library?

    Can i add a lossless music file to my itunes library? Usually what i do is drag the file or folder into music/itunes/itunes media/automatically add to itunes and it works fine, everything shows in my library and plays perfectly. But with this lossless file i drag it into the automatically add to itunes folder and it goes into the folder but doesnt show up in itunes. I think i know that itunes doesn't support lossless files, so can somene tell me how to convert them into apple lossless or MP3s (preferably apple lossless). Please help.

    The are a variety of different lossless audio formats, some supported by iTunes, some partially supported and some not at all.
    The best lossless audio format to use from an iTunes point of view is Apple Lossless aka. ALAC. iTunes can import (rip) audio CDs using this format. Other lossless formats supported by iTunes include WAV (partially) and AIFF, however these formats use more disk space than Apple Lossless and do not sound any better, and further more do not support meta-tags as well as Apple Lossless.
    Another lossless format you may hear of is FLAC, iTunes does not support this format but it can be otherwise considered equivalent to Apple Lossless in file size and capability. You can convert FLAC to Apple Lossless with of course no loss of quality but you will need to use another utility to do the conversion.
    There is also WMA Lossless, this is not supported for playing by iTunes but I believe can be imported (only in iTunes for Windows, not Mac).
    So, contrary to your message, yes iTunes does support lossless audio files.
    For what its worth I have all mine in Apple Lossless and share it with Windows Media Player and Microsoft Media Center which can also play Apple Lossless (with an additional free directshow filter).
    Note: Music purchased from the iTunes store will all be in AAC format which is a lossey format.

  • How can I add an audio file to a .mov video?

    Im trying to add an audio file (format 'aiff'), to a video in the format of .mov
    I can't find anything that will just let me combine the two files to make one .mov video file.
    Any suggestions?
    Cheers!

    Drag and drop one music files onto each slide then export. (File > Export > HTML)

  • Can i add a pdf file

    Can I add a downloadable PDF file to my website created in i.web?

    There's a couple of ways to do this...
    http://www.iwebformusicians.com/iWeb/PDFs.html
    "I may receive some form of compensation, financial or otherwise, from my recommendation or link."

  • Can't add some video files

    I can't import or add a video file. The file is MP4. When I try to add to library, iTunes doesn't do anything. What should I do to have that video be in my library.

    Do you have the "show only the synched items" box checked? It's on the summary page when you have Apple TV selected under devices in iTunes. I had this problem and it took me a while to see it...now if my Apple TV would just stay connected to iTunes......or if someone could help me downgrade to 2.0 I'd be golden.

  • Can I add music wave files to a web sight using muse ?

    60 year old guy trying to find out information, so hope I don't sound too dumb.
    Can I have a web sight with waves files in it , like regular music , not MP2 or ACC files ?
    Also , can I add my own videos without using YouTube ?  Just place them on my web page ?
    If later on , I want to sell something , can I do it on the web sight ?
    I want to use Muse.
    Oh yea , I have a recording studio .  That's why I need to know what my options are .
    Thanks ,
    Paul

    Hi Paul
    Yes, you can embed your own video and audio.
    Please refer to these threads :
    https://forums.adobe.com/message/6292572#6292572
    https://forums.adobe.com/message/6066684#6066684
    how I can embed a .mov file in adobe muse
    Thanks,
    Sanjit

  • Can't add a .ts file to Premiere Elements 12

    Hi all,
    it's me again. I tried to add a .ts file to Premiere Elements 12, but the program crashes every time. My system is a Macbook Pro OS X 10.9, 2.5 GHz, 8 GB RAM.
    This is what Mediainfo says about the file:
    I thought it's because of the file size. The original file is 8 GB (I recorded it with a sat-receiver). So I used the cutter to make it smaller but Premiere still crashes.
    I tried another thing and used a video converter program, exported the same file also as a .ts file, and this one I can add to Prmiere without any problems. I just don't want to do this with every file because it takes the whole night to convert one single file :O
    Any help is greatly appreciated, thank you in advance.
    Jessie

    ATR,
    thanks for answering. You're right, the .ts format is not listed as import format, but I read about it in a few forums as I searched for a program according to my requirements and that is not too expensive.
    However, last night I tried a lot and I read a lot about the codecs because I assumed my problem has to do something with the audio layers. I created two test files, and I was able to import one file, but not the other. The audio layer was the only difference between these two files. So I installed the missing AC3- and A52-codec and it worked so far. Though I have to say that I don't really know if that was the issue as I found out it takes quite a time for Premiere to import these large .ts files. I always thought the program crashed, you know, a spinning mouse pointer, no reactions at all, the small window with the import progress stayed at 0 % the whole time, and when I right-clicked on the icon in the dock it said "Program is not responding".
    I also found out that I can transcode the .ts files with VLC player (much faster than the other program I used before) and reduce the audio bitrate, and Premiere works much faster with the new transcoded file.
    So I think I can live with this workaround
    Thanks again,
    Jessie

  • Can't add any new files to itunes

    Hi
    In the past I've managed to add new music files via "file" then "add file to library" from the top toolbar - the file is then added to your libra.
    For some reason this isn't working now! Get to select a file, but when press oK nothing is added.
    Would anyone know if I'm missing something to make this work, or if there is another way to add a file?
    big thanks
    andy

    Hi Andy,
    Welcome to Apple Discussions.
    Will the files play in Quicktime Player? iTunes sometimes has problems recognising MP3 files and won't import them.
    If they open in QT Player you could export them as a different format and see if they import then?
    Hope this helps.
    Regards,
    Peter.

Maybe you are looking for