Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

buldre

macrumors newbie
Original poster
Jan 25, 2010
28
0
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:
 
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.
 
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.

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?
 
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.
 
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.

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
 
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

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:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.