What to do with CSV after exporting to iPhone?

One of the requested features for my applications is to have an export function. In most cases, the data is similar to tables in nature. As an example, users can enter daily what types of food they ate that day, and how many servings of each type of food. Since the data is tabular, I believe that the CSV format will be most useful for export. It can then be read in spreadsheet software.

I am sure that I can receive data in CSV format without any problems, and found that this message should help me: How to convert data to CSV or HTML format on iOS?

What am I interested in, what can I do with a file after it's created? Can I attach it to an email? How else can I make it available to the user so that it has some use?

Alternatively, I'm going to do it wrong and is there a better way to offer an export function?

+4
source share
2 answers

I would suggest using MFMailComposeViewController and bind a CSV file to it. This allows the user to forward the file to multiple recipients, customize the body of the email, etc. You can also embed HTML in the body of the email, so if the data is not too large, you can simply present the table of information in the email itself.

To send an attachment, follow the instructions here .

+1
source

Typically, when an iPhone application needs to be exported, you have the following options:

  • Attach it to an email (as you mentioned)
  • Sending it to the server (using the HTTP protocol or any other protocol based on the TCP / IP protocol)
  • Providing it with the small WebServer that you encode inside your application (e.g. APP for camcorder for 3G and older iPhones).

Unfortunately, you cannot use iTunes to sync the exported file. At least you cannot use the current version of the SDK.

Instead of CSV, I would use XML. It can also be read using Excel (or any other table), plus you do not have to deal with COMMA output (or any other delimiter).

0
source

Source: https://habr.com/ru/post/1309723/


All Articles