iOS File Not Found Error

Posted on 2012-09-12
Last Modified: 2012-09-13
Hello Experts,

I am developing an iOS program for iPad. The program performs some simple calculations and in the course of doing so, it reads a text file containing a lookup table (table.txt). It works fine when I run it in XCode using the iPad simulator, but when I run it on my iPad, it gives a “File not found” error. I’m reasonably sure it’s not finding the table.txt file, but I’m not sure how to verify that the table.txt file is being transferred to the iPad as part of the application test installation. I used Xcode’s “Add Files To …” function to make sure the table.txt file was added to the project, and I also visited the Target|Copy Bundle Resources pane to make sure the table.txt file was one of the items in the list.

Curiously, the program reads another data file (page0.psf) supposedly from the same directory without a problem.

I’m an old Windows programmer new to iOS so I’m not sure what I may be doing wrong. Any ideas?
Question by:efz
    LVL 14

    Accepted Solution

    The first step is to ensure that the file is copied to its correct location on the iDevice.
    Download and install this free iOS file system browser, iExplorer:

    Run the application; Connect your iDevice; Go to /private/var/mobile/Applications/;
    find your application's directory and check whether it exists at where it was supposed to be.
    Report the result here for further assistance.
    LVL 33

    Assisted Solution

    Check the full file name - iOS is a case sensitive file system.
    If this file has name table.txt and it's located in the application bundle, you can load it

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"table" ofType:@"txt"];  
    if (filePath) {  
        NSString *theText = [NSString stringWithContentsOfFile:filePath];  
        if (theText) {  

    Open in new window

    LVL 14

    Expert Comment

    by:Hamidreza Vakilian
    If it was due to a character case mismatch then he would also had faced the issue on iOS simulator.
    It's probably because the file does not take place in the supposed path, or a simple path calculation mistake.
    LVL 33

    Expert Comment

    Programmer-x: It's not absolutely correct. At least on my Mac do not have the case sensitive system and so on the simulator.

    Author Closing Comment

    You two are golden. Both were right. Even though I was aware of the case sensitivity issue I had previously placed a mis-capitalized file name on the iPad and later file transfers were not overwriting the file name even though I had corrected it on the Mac. Therefore it was a case senstitivity issue.

    However, I could never (ever) have diagnosed this problem without using the iExplorer tool recommended by pgnatyuk. Truly a necessary first step.

    Excellent advice.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Ever wanted to watch videos in your computer from the bed without the need of standing up and shutting down the computer?  Is your computers operating system Windows XP, Windows Vista or Windows 7?  Do you own a iOS device? If all the answers were y…
    There is a security feature on iOS devices that is nearly impenetrable when it has been activated.  This article will provide some possible solutions as well as necessary steps to take to ensure you do not end up with a locked device.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now