How to get a file from my computer to the iphone

Discussion in 'iOS Programming' started by buldre, Mar 15, 2010.

  1. buldre macrumors newbie

    Joined:
    Jan 25, 2010
    #1
    Hi all,

    I need to get a file from my computer to the Iphone. My aim; to read the file and load the contents of it into an array in my Iphone program. This should be done every time i load the program.

    To specify; im using the Iphone to make some biometric tests, and i need to upload the template (which i've created offline) onto the Iphone so that i can compare against it when people perform a gesture with the Iphone.

    Any ideas would be greatly appreciated.

    Cheers :apple:
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Is this just for your own testing or will other users also do this? Is this meant to be controlled by user action or automatic?

    You can use Mac Web Sharing to serve any file and use NSURLConnection to download a file from your development computer to your device, just like a download from any web site.
     
  3. buldre thread starter macrumors newbie

    Joined:
    Jan 25, 2010
    #3
    I'll try and specify; this is a static file. It has to be unvisible for the users, in the terms that this file is loaded into the arrays before the application launches. My entire application relies on this. Is it possible to include the static file to my xcode project in some way? If so; how do i reference/use it?
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Add it to the project including it in the Resources section. It'll get copied as a resource and you can load it using the normal methods (so say a combination of NSString and NSBundle methods). Before you ask, no, I won't post code: this is very basic and is covered all over the place: use Google, read the documents and work it out.
     
  5. buldre thread starter macrumors newbie

    Joined:
    Jan 25, 2010
    #5
    Thank you :) In that case the only thing i wonder about is what the path to the file will be if i include it as a reference like you said
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    Look at the NSBundle documentation: it has an API to find the path of a given file in your resources. I didn't just include it for fun. I expected you'd read it :rolleyes:
     
  7. buldre thread starter macrumors newbie

    Joined:
    Jan 25, 2010

Share This Page