How to upload files using http / ftp to iphone / ipad? (E.g. ifile, goodreader)

Are there any good tips for downloading files to your device? I saw that many applications create an 80 or 8080 HTTP server to download files. Does this mean that I should also implement a server?

Are there any third-party libraries? (Preferably open source and non-GPL)

EDIT: I'm going to update the files in the application for certain devices in a corporate environment, so I can also pull the ipad files from the central server. But I would have to send messages to these ipads to tell them to extract these files.

+8
ios objective-c iphone file-upload
source share
7 answers

I guess what you want is a kind of automatic update. The application does something by order from the server without manual control.

I do not know the enterprise-specific licensing feature of iOS. But I believe that there are no such APIs for a particular enterprise. And, as I know, automatic updating is almost impossible. So,

  • There is no system level support for automatic updates. (Till?)
  • Thus, the messaging and fetching function must be implemented in the application.
  • But no application can run in the background for a long time.
  • And also the user can disconnect any application at any time.
  • Unable to send a message to an application that does not work.
  • Even you can send, there is no way to address each client with a server form.

If your application is running, sending or managing a message to retrieve or perform something is just the job. The problem is that there is no ordinary way to keep them always alive. Even in situations such as OS reboot or abnormal termination.

However, there is an alternative. Simply register the application as a VOIP application, such as Skype. OS also does not support the application, but it will control a specific port of the socket and wake your application when the socket receives some kind of message. For more information see here: http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH5-SW15

In the AppStore, an application that uses VOIP for other purposes, such as automatic updates, will not be transferred, but you do not need to worry about it.

And another way to send a message to a device without starting the application is to push a notification. This is a feature supported at the system level. But this is not intended for a batch application. This is for sending a text message. Therefore, if your application is not running, a message will be displayed to the user. However, you can direct the user to launch the application by sending a push notification.

As a final option, you can request some features for Apple for the corporate environment. If your company is large enough to receive a volume license, Apple will seriously consider your feature request.


If you decide to use the VOIP method, I'm sorry that I can no longer help you. I have no experience implementing such an application. But it should not be so difficult.

However, the hard part is the server. This definitely requires a dedicated server program that supports a TCP / IP connection. Unable to use regular HTTP server. Because HTTP itself is designed to not support a TCP / IP connection. You must build this server yourself from scratch. You will have to handle lower-level TCP / IP transfers.

There are several solutions (both free and commercial) for this kind of server, but none of them are popular, because this type of server regularly needs to be fully configured. Thus, there is nothing to reuse or share.

However, I believe that this is the most suitable implementation for your application.


If you can satisfy automatic updates only when the application starts, you can archive it by periodically checking the server status from the client.

This is easy to implement, as you can use regular HTTP servers for this. The client periodically connects and downloads the latest updates from the central server. If there is a new update, just select and do what you want. And the application is running, check the update first. Prevent the entire operation until the update is applied.

This is the usual way. Most applications are built using this method. In this case, you do not need to implement a server or a complicated thing.

However, the update rate depends on the polling period.


(Edit)

I do not like private APIs. Because your application is not for the AppStore, so you are free to use the private API. (This is another hacking case in jail. There are so many hidden features that are excluded from the documentation.) I do not know about private APIs, but maybe there are some APIs that allow you to support application support. However, this reverse engineering work is so painful if you were not born to crack.

+2
source

But I would have to send messages to these ipads to tell them to receive these files.

Push Notification Programming Guide

Or email a custom URL scheme to launch the application.

IOS Application Programming Guide - Implementing Custom URL Schemas

+3
source

You can try using the following open source code in your project:

http://code.google.com/p/cocoahttpserver/

https://github.com/robin/cocoa-web-resource/wiki

+2
source

Apple has sample code on its website that exactly determines what you are looking for:

http://developer.apple.com/library/mac/samplecode/CocoaHTTPServer/CocoaHTTPServer.zip

+1
source

So you have a few options:

  • You can distribute your application for free in your organization and display new content in the form of application updates. Apple provides this option with its Enterprise Developers .

    Wireless Application Distribution

    The iPhone allows businesses to securely host and distribute employee wireless applications over Wi-Fi and 3G. Applications can be updated without having to connect users to their computers. Embedded applications can be hosted on any web server accessible to users. Users simply click on the URL to install applications wirelessly without having to connect to their computers.

  • An alternative is to configure the application to retrieve updated data. You are describing adding an HTTP server to an iOS device, but the server cannot receive data when the application is down. Given your needs, it’s likely that it’s best to implement a web client in your application.

    If I were on your side (and option # 1 did not work), I would use ASIHTTPRequest to check with the server at startup / daily. If new updates appear, the application can either ask the user that there are new data files to download, or simply quietly download them in the background stream.

    UPDATED: Perhaps I should talk in more detail about how to do # 2. You can configure the download so that it does not interrupt when the user leaves the application (you do not need to do Voip hacks). Check out Finishing a finite length task in the background in the iOS programming guide.

+1
source

There are http server code examples from Apple and the open source community, such as cocoahttpserver TouchHTTPD. You can upload the file to the http server on iphone.

Here the blog and screenshots about launch cocoahttpserver and upload the file to iphone .

+1
source

Python CGIHTTPServer allows you to create a server in 0 lines of code:

jcomeau@intrepid:~/rentacoder/bin2txt$ python -m CGIHTTPServer Serving HTTP on 0.0.0.0 port 8000 ... 

In fact, implementing a script to parse input and save the file would require a bit more effort.

[later] Alright, so forget about it, Apple doesn't allow it. See Local Server on iPad for iPad at least.

-2
source

All Articles