PDA

View Full Version : Can an iPhone App create and send + receive and read a CSV file as an ATTACHMENT?




RottenApple2
Jul 17, 2010, 06:53 AM
I'd like to introduce a feature in my iPhone App that allows the following:
1) creating and sending by email a CSV file from within my iPhone App.
2) importing into my iPhone App a CSV file created with 3rd party software and sent to me by email.

These are the questions:
1a) Is it possible to actually create a CSV file from within the App and send it as an attachment? I know I can send an email containing all the strings required, but I want to be able to send the actual file.
1b) Once created, can this file be stored into the memory allocated to my iPhone App?
2) What procedure should I follow to import a CSV file into my App? I do not want to read the CSV file from a URL.
Can all this be done with the iPhone or not??

Thanks!



robbieduncan
Jul 17, 2010, 07:06 AM
1a) Yes: you can write any sort of file you like to your applications sandboxed area of the filesystem. You can the use the Message UI API (http://developer.apple.com/iphone/library/documentation/MessageUI/Reference/MFMailComposeViewController_class/Reference/Reference.html#//apple_ref/occ/instm/MFMailComposeViewController/addAttachmentData:mimeType:fileName:) to attach this to an email.

1b) By memory do you really mean memory? Or space on the filesystem (which is never referred to as memory by a programmer)?

2) You can register for filetypes (http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StandardBehaviors/StandardBehaviors.html#//apple_ref/doc/uid/TP40007072-CH4-SW12) your app can open in iOS 4.

The documentation is there for a reason: use it. It answers your questions.