iPhone data export - iphone

I'm writing a data collection app for the iPhone, and want to be able to export my data to a file the user can process on their desktop. I'd generate the file in csv or whatever format on the iPhone and then somehow the user would get the file to their desktop. From reading other questions here and on the rest of the web, it seems like my options are:
1) Implement my own web service somewhere in the cloud which the iPhone app connects to and sends the data. Then my server would either email it to the user or make it available for download somehow.
2) Write SMTP code or use an off the shelf library, which would require the user to enter their own email server details. Then send the data to the user as an attachment.
3) Use some kind of bonjour setup where I give the user an app to run on their desktop and the iPhone app finds and talks to that desktop app.
All three of these seem cumbersome: #1 for me because I have to code/maintain a server (including detecting/preventing spam/misuse, etc). #2 and #3 for the user because there's extra configuration, stuff to run, and things that can go wrong. (Not to mention a bunch more things to code and test for me, potentially with a bunch of desktop OSes and configurations.)
Are these the options people are using? Did I miss any? Which do people like best?
Thanks much!

You can run a web server on the phone, and point the user at that IP address, then serve up an AJAXy web page where they can download the file to their desktop.
Not hard, but they have to type in an IP address or http://myphone.local type address...

Related

Simple Localhost Server in Xcode/Swift?

I am making a macos app in XCode, and I was wondering if there was a way to make it host a local server that is visible across the network.
I am trying to find a way so that it would host something on the devices's network with it's hostname/ip address, so if someone goes to http://hostname:5000 they would be able to see the response, and the app would be able to see the request, just like how hosting a local python server works. Is there any way to do this in XCode with Swift?
For example: the user presses 'start server' on their screen. The server is hosted across the network. Anytime a request is made to it, they get a notification.
Just to make you concern you may find some sample codes, including local web server inside the app.Few of them I found are:
https://github.com/ooper-shlab/MyWebViewApp-Swift
https://github.com/depoon/SwiftLocalhost
The main thing is it's just a public
, experimental code, so it's not simple, not easy to adopt, not all coding best-recommended, far from readable and may have severe bugs.But you can use it as a working example and take any parts of it into your app.

Email link to launch executable. Will my email get blocked as spam or dangerous?

Just wondering if anyone has experience in sending an email with a link in it to launch an executable.
We have clients that require a license key of sorts to be emailed to them, I had an idea to send a link that would launch at executable on the local system and import the license automatically, but I'm assuming this would be blocked by virus protection or spam blockers. Am I right in assuming this?
I am also up for other suggestions on how to import a long string of data in to a database easily without much user interaction.
Thanks :)
Sending a link to an executable does not seem like a good idea for me since the user have to download an application manually and execute it.
Probably you can make the licensing logic a part of core application and launch the application using a custom URI scheme. As an example your URL looks like abc://myurl.com?parameters. When the user clicks on it your application gets launched with necessary parameters. The application knows how to proceed with the licensing process from that point onward.

Is it possible to send a file from the client computer on a perl web application without uploading it to the server first?

I've looked for this around the internet without getting any good answer so far, so here's the issue:
I have a perl web application used by a small group of people (accessed by their web browser on windows computers, around 100 users) , on an intranet (this application is on a RedHat Apache server) , this application gets the user's inputs and uses WWW::Mechanize to send everything to another page on (a different server, which shouldn't be used directly), process a form and return the result (I know it may not sound optimal, but it was done according to what was required), the issue here is that I need the users to be able to send a file (most likely it will be an image of ~500kB, either through WWW::Mechanize along with the other form data that gets submitted, or by an email with an attachment, either option is equally acceptable), and I know the file can be sent/attached if it's already on the server, my question is simple:
Is it possible to send a file from the client computer (running the perl web application on the browser) without uploading it to the server (that will send it) first?
P.S. This is not one of those "give me the code" questions, I'm not asking for any specific code, I just want to know if this is something that could be done (and if it is to have an idea how), or if I absolutely have to upload the file to the server running the perl application first (I already have a script for that). If this is not possible it's ok, I just want to be sure if I need to upload to the server first before sending the file.
Assuming I understand you correctly, yes, you can upload a file through WWW::Mechanize. See the pb-upload example.
Yes it can be done if the client computer has a mail client that is configurable enough to allow a commmand of the type "mail $TO $SUBJECT -attachment $ATT_FILE". Even then you need user to cooperate by launching the action.
Otherwise, no. You can't do it via JavaScript AFAIK due to sandbox restrictions.
I don't know enough about Flash to know if that's an option.

How to send data to webserver and know it comes from a certain application?

I'm trying to send data from my application to a webserver.
The catch is that I want to encrypt the sent data and also make sure it comes from my application. (From what I've read so far it's easy to decrypt the data if it's not sent via HTTPS. On the unique application I didn't find anything except the Application ID Apple provides for each application but I don't know how that works).
The data sent are various highscores and achievements that the user can enable. The thing is that the user doesn't have to type in anything but his username and having that associated with the UDID it should be enough.
But how to make sure it's from my application?
Edit:After reading some responses around here I still didn't understand something:
If someone extracts the IPA and reverse engineers it wouldn't he have access to all my .h and .m so he can look up anything in there?
You could generate a client certificate for the iPhone app, and use mutual authentication for your SSL handshake. Then you know that data submitted to the server come from a particular user of the app, and that your app is communicating with the correct server.
Regarding your edited update, yes if someone reverse-engineeres your app they can probably work out how the high-scores are protected. But seriously, how much trouble do you expect most people to go to in order to fake a high score in a game? Are you offering a cash prize or something?
If you are using HTTPS then you can just put an identifier key in your POST to the web server, either as a field or perhaps an HTTP header that identifies your app. The entire connection is encrypted so it will be protected. If you do this you will want to encrypt the key even in your binary and decrypt it as you send it over the connection, that way no one will be able to pull it out with a hex editor.
Another approach if all you want is to know that the data comes from an authentic instance of your application is to use message authentication codes (MAC). I leave deciding how strongly the key needs protecting as an exercise to the reader - you know your security requirements better than I do.
You can use CommonCrypto - part of the iOS SDK since forever - to actually generate the MAC.

Persistence on an online click once application

Is there a way to persist an string from an online click once application. I saw something about isolated file storage as answers to other questions. But none of them specify if it works also for online apps (I really don't think so).
I think that something like a cookie will work. Is there something like that available?
The application must run only online (is triggered with some parameters), but for each user it needs to save a file with specific information asked to him. Once the app runs for the very first time it must not ask for that info to the user.
Thanks.
You can store the information in LocalApplicationData. Just create a directory with either your application name or your company name, stick the string in a file, and read it from there. This article shows you how to persist this data, and not have it impacted by ClickOnce updates. It will work even though your application is online-only. (Online-only C/O apps are still installed, it just means it always runs it from the URL, and requires the user to be connected in order to install the app.)