Hi, I'm a young iphone dev who needs to download a .txt file from a web (I got a ftp sever) to update a small database on the device. Anyone could give me an advice of how to do this?
Thanks.
Hi, I'm a young iphone dev who needs to download a .txt file from a web (I got a ftp sever) to update a small database on the device. Anyone could give me an advice of how to do this?
Thanks.
Downloading it (see Downloading to a Predetermined Destination)
NSURLRequest* req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"ftp://myftpserver/path/to/file.txt"]];
Reading it (see String Programming Guide)
float aFloat;
NSScanner *theScanner = [NSScanner scannerWithString:aString];
while ([theScanner isAtEnd] == NO) {
[theScanner scanFloat:&aFloat];
// implementation continues...
}
Updating the Database, it all depends on what you are using for a Database. I would start with the Core Data Overview and SQLite docs
I think using a NSURLDownload would be better as it is meant for it lol.