English 中文(简体)
*Send to Instagram* Trick by *100 Cameras in 1*
原标题:

From Day One I was told that each third-party iOS app was perfectly sand-boxed and therefore there was no way for a third-party app to transfer messages other than some pre-defined urls to another app.

But this Send to Instagram trick done by 100 Cameras in 1 just caught my attention. When the user triggers this action, he jumps from 100 Cameras in 1 to Instagram right away (which is OK and could be easily implemented by the url trick mentioned above.) However, what is interesting is that Instagram will display the image just processed by 100 Camera in 1 as if it was displaying a image from its own sandbox.

I understand that Cocoa Touch must have some APIs to support this. My question is, what are they? Are they only limited to images?

Thanks a lot in advance.

Edited: I understand there s the Cocoa Touch URL scheme thing, but if it s the url scheme that did the trick... the url scheme must contain info of a pointer/reference to the image. Otherwise even if we jump from 100 Cameras in 1 to Instagram, Instagram won t have access to that image.

Edited (2nd time): Though I haven t tried yet, Tom H s answer might finally led to a solution. So I accepted his answer as the final answer. As for unset s answer, unset kept mentioning the url scheme thing (but dude, we all know that. And it s not the switching-between-apps-by-calling-url that confused us. It s how Instagram accessed that image from another app that confused us.) Since unset s answer doesn t provide much useful info and never answered my question to the point, I down-voted his answer, and I suggest those who up-voted adjust your votes accordingly. Stack Overflow is a great place because we could almost always have answers that are to the point, not because there are people who s answers are nothing wrong but are never really to the point.

Edited (3rd time): The official Instagram developer page now gives the official solution.

If your application creates photos and you d like your users to share these photos using Instagram, you can use the Document Interaction API to open your photo in Instagram s sharing flow.

You must first save your file in PNG or JPEG (preferred) format and use the filename extension ".ig". Using the iOS Document Interaction APIs you can trigger the photo to be opened by Instagram. The Identifier for our Document Interaction UTI is com.instagram.photo, and it conforms to the public/jpeg and public/png UTIs. See the Apple documentation articles: Previewing and Opening Files and the UIDocumentInteractionController Class Reference for more information.

When triggered, Instagram will immediately present the user with our filter screen. The image is preloaded and sized appropriately for Instagram. Other than using the appropriate image format, described above, our only requirement is that the image is at least 612px tall and/or wide. For best results, Instagram prefers opening a JPEG that is 612px by 612px square. If the image is larger, it will be resized dynamically.

An important note: If either dimension of the image is less than 612 pixels, Instagram will present an alert to the user saying we were unable to open the file. It s our current policy not to upscale or stretch images to our minimum dimension.

最佳回答

If anyone s interested, here s the actual documentation needed to do such a thing:

http://instagram.com/developer/iphone-hooks/

问题回答

Instagram has registered the URL scheme instagram:// (type "instagram://something" in your iPhones safari and hit "open"). Maybe your app has discovered the format to send images into Instagram – or Instagram provides a documented API.

For the possible parameters, check this post.

I think what s happening (or what could possibly happen, also thank you Angelo) is first:

100 Cameras in 1 saves the image to Photos.app.
Then, it passes the name/filename/path of the image to Instagram (via the url scheme).
Then, Instagram retrives the photo from Photos.app, and loads it up.

There is probably not a way to do this with things other than images, however if you have a look at the UIDocumentInteractionController class which lets you open files in other apps, to an extent.





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签