Search
Recommended for You

A proposal for SDK-compliant copy & paste


This morning, I had one of my d'oh moments: finally figuring out exactly how to do inter-app copy and paste without breaking SDK rules. It basically goes like this, in a similar fashion to the Core Location service I wrote about a few months ago:

To make copy/paste work, you need to install a central application. I'm going to call it "CopyPasteOMatic" for no particularly good reason. It has a custom URL scheme, cpomatic://. You can call it in one of two ways, either as a paster or a pastee.

Each client on the iPhone must supply its own custom URL scheme, and pass it when calling CopyPasteOMatic. For example, scheme=vnotes lets CPOmatic know who to return the data to.

Clients need to pass an operation as well, either op=copy or op=paste. There's no need to specify whether a paste should be public or private because all pastes are public, but it might help to paste with a key though, allowing developers to put application-specific data into a public mailbox that can be consumed by other apps regardless of the system clipboard.

Should security be an issue, I think it would be possible to issue public and private keys that authenticate the copy or paste request, so developers can control where their data is allowed to go. The drawback of that would be that CopyPasteOMatic would have to call home every now and then to download and store those keys in the local keychain.

As for the data itself, that could be posted in URI-encoded strings attached to the URLS, going into or out of the paste service. The obvious drawback is going to be length. I'm unsure as to how long a URL the iPhone will permit to be opened between applications.

Anyway, so that's the idea in a nutshell: a community developed central cut/paste application and a well-defined protocol to support it. How much would you like to bet that it would never get accepted into AppStore?

AddThis Social Bookmark Button
Comments (6)

6 Comments

WiFone 0SMX86 said:

BIG +1 !!

Jeremy said:

Do you really think Apple isn't going to address this at some point? If people really want it (I haven't seen even the slightest, most remote need for it, but there are some vocal supporters) then Apple will eventually get to it, making all your work redundant. Why bother?

epiPhoné said:

URLs can be pretty long, since they manage to accomodate relativey large CSV data streams from our apps. Unless users are copying huge documents, I can't imagine it will be a problem. If they are pasting the chapter of a book, they are abusing copy&paste anyway.

For the iPhone, wouldn't a client-server system with transactions occurring over https be easier to deal with? It isn't like this would be a lot of data.

Stephan said:

fine, but the real problem is that there is no way to select text on the iphone. Copy and Paste isn't worth much if the user can't chose which part of a text to copy.

Matthew said:

How about using NSHTTPCookieStorage ?? This is shared between applications.

Leave a comment


Type the characters you see in the picture above.