Delphi iOS import/export data file using email - ios

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

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.

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

Related

WKWebView File System Browser

I've been asked to add a file browser to an existing Objective C application that uses a WKWebView to load up a Javascript internal app.
Currently we have the capability of looking at the pictures on device to upload images into the app, but I've now been asked to do the same with more generic file types, specifically PDFs.
What I've read so far is that this is only possible if a file is stored in a specific part of the file system and only if the app knows exactly where the file is to begin with, but what I need is the capability to browse to a certain degree.
What I'd like to know is whether this is possible and if there is a good place to start on that?
Thanks.

IPhone: Best way to deliver configuration file to test application

Main Problem
I have to write test application for iOS to test very complex multi platform framework.
There are already applications for other platforms which are using common configuration file (which defines test servers, user names, log level, and so on). Configuration process is quite complex so providing a complex UI will be waste of time on mobile platforms.
This file is a xml and its file name extension is xml.
Tester will have multiple configuration files (will use only one at the time)
This files should be easily uploaded by tester
tester should be able to select configuration file
What solution I'm looking for
At bagging I was thinking about iCloud service. Problem is that in 90% of cases device is shared by multiple people (testers and developers), so I'm not convinced this is best approach, since this will provide problems with sharing an iCloud account (usually there is account per device not per tester/project).
It would be best if this files could be delivered to application by using iTunes. Anyone who will do test will have this tool to install test application, so it would be nice if he could upload those files too.
Any useful hint will be appreciated (not necessary a full solution).
As a bonus opposite direction would be also useful (fetching logs). Currently usually logs are send by an email. If it is possible to easily fetch this in same meaner as configuration file it would be great.
Ok looks like it is possible to do this with iTunes.
When inspecting list of installed app for device in iTunes at the bottom there is a section "File Sharing" where you can add remove files.
If you want
That your test application for iOS, test something by readying XML File
There are different XML files
There are different testers.
In this case rather than doing too much you can
Ask testers to upload the files in dropbox.
Have a textbox in your app, in which user will type the URL of XML file (which they have uploaded on dropbox)
And next to it you have test button on click of it you can download the file and test against the logic.
Once the test is over you can grab the result by email or ask them to upload on Dropbox (manually or using api).
Ok I've finally found something like that. This perfectly solves my problem.
Files will be uploaded and downloaded by iTunes.
Another helpful link.

Encrypting or protecting files stored in iOS app's NSDocumentsDirectory

I have a custom requirement in one of my products and I need to protect or encrypt files that are stored inside the NSDocumentsDirectory folder. Even if these documents are mailed (The app has the ability to mail documents) to some other person , he or she will not be able to open this document without using my app (I will be using open in functionality of email attachments). So basically only the application can access all these documents and without the app the documents should be mere junk. IS there any way to do it, or has any one done something before.
I also saw this but could not get a complete idea.
If you want a quick and easy method for data that doesn't need serious security, just zip the files with a fixed password.
ZipArchive is a good library for this.
For a more serious approach, check iOS - Protecting files with a custom encryption key?
The other post you mentioned works on the concept of password protecting the files, I had encountered the same issue that was for my custom defined files in which our team, encoded the contents of the file on random locations, and saved it.
Only our Application could decode it correctly as we had the key :)
It was a windows application, It would work here also.

Download FTP directory contents to ios

I have a website, let's say it's "http://www.jwilkthings.com/stuff"
I have a bunch of .txt files stored on this website, i.e. "http://www.jwilkthings.com/stuff/text1.txt"
What I'm wanting to do is find a way in iOS to download all of those text files without knowing what the document name is. I can already retrieve them manually as long as I have a file name, but I would rather just get all of them at once and put them in the documents directory if possible. I currently use FileZilla to upload all of the text files, so I can use FTP if needed.
The correct way to solve this problem is to not use FTP (riddled with performance and security issues), and to configure your web server to expose a table of contents directory listing that your client can parse.
But that's not an answer to your question.
If you really want your iOS app to speak FTP, take a look at the SimpleFTP sample project from Apple.
It's old, but I just got it to build on iOS 5. The ListController.m file has the code you're looking for.

Config file to change values within an app

I'm having a problem meeting a requirement for an Java app I'm developing. My client must be able to deploy the app to multiple BES servers without the need to resign the code (or have any interaction with the developers). Currently the web address of one of their BES servers is hard coded into the app but they require the ability to change this value at will prior to deployment. (it can be assumed they will administrate any BES server the app is deployed from)
I've tried attaching a text file to the project which is read by the app but this is packaged along with the app, meaning it can't be manually edited (as far as I'm aware), I've also tried having a custom property in the JAD file but this needs resigned after any change.
Am I doing any of these approaches wrong or is there a better solution I'm missing?
Also, is it possible to deploy a simple text file to a BlackBerry via the BES to a specific file location? If so I could have my app read this file which would solve the problem?
Thanks,
Implement custom attachment handler in your application.
And send email with an attached xml-config file to BlackBerry device.
User opens the received message and selects the custom menu item provided by attachment handler.
And you can parse this xml config and act accordingly.
An easier way is to use a user defined ItPolicy to provide the configuration information you need.

Resources