Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi iOS import/export data file using email

Assuming I have an app on iOS that generates a data file, and I would like the user the ability to import/export that file, how is that best done?

Import from email in xcode/objc: http://www.raywenderlich.com/1980/email-tutorial-for-ios-how-to-import-and-export-app-data-via-email-in-your-ios-app

Is this possible in Delphi? (i.e. register an ios app as file handler for a specifc file type)

(I am planning on handling export through generating an email attaching a file? I suspect this is probably possible although if anyone knows for sure, feel free to share)

It has been asked why import/export across email is useful.

  • Because legally EU/US law and cloud storage is difficult with personal data
  • You don't need any desktop computers
  • You can sync data between ios and android apps if user changes mobile
  • You are not bound to any specific cloud provider or anything similar

Quote from above article where author explains where the file path is passed to the app:

application:didFinishLaunchingWithOptions, passing the URL in the UIApplicationLaunchOptionsURLKey, or via application:handleOpenURL.

But since I have not used Delphi for ages (for mobile), I would just like to know for sure if Delphi supports this or not before buying a new version

like image 684
Tom Avatar asked Mar 14 '23 18:03

Tom


2 Answers

You can send files using email. I use the email component from D.P.F Delphi iOS Native Components to send file attachments using email. I don't see any reason why you should not be able to send your data file as long as it is not too big. Use a file extension that is unique to your app.

You could also use iTunes filesharing in order to give your users direct access to your data file. Just set the UIFileSharingEnabled key in your info.plist and store you data file inside of the documents folder. This does require a desktop PC, but it is still a very nice addition to sending backups by email.

like image 87
Sebastian Z Avatar answered Mar 23 '23 18:03

Sebastian Z


Depending on your needs,

I would suggest looking at perhaps saving the file to a server using FTP and Indy and then on the other device you can retrieve it?

http://www.delphipages.com/forum/showthread.php?t=208397

  • Set the TidFTP connection parameters
  • Do a FTP put : // ftp.Put('testfile.txt');
  • Perhaps have a Database with a column that you specify a file version etc
  • Do a simple Get request if you want to retrive the file with the filename

or Alternatively you can save it to a blob field in a DB and have the other device read the blobfield if you don't want to do it via FTP

like image 43
Peter-John Jansen Avatar answered Mar 23 '23 18:03

Peter-John Jansen