Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open image with Instagram

Hi I need to import my edited image in Instagram , something like PhotoStudio :

enter image description here

I captured my image with this code :

    UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0);
    [self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

Then I need to open this screenShot with Instagram:


EDITED:

I implement the method like this :

    UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0);
    [self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]];

    docFile.UTI = @"com.instagram.photo";
    [self setupDocumentControllerWithURL:igImageHookFile];

    NSURL *instagramURL = [NSURL URLWithString:@"instagram://media?id=MEDIA_ID"];
    if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
        [[UIApplication sharedApplication] openURL:instagramURL];
    }

    else {   
        NSLog(@"No Instagram Found");
    }
}

But I receive this output :

2012-05-05 21:55:36.842 InstantFrame[855:707] *** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit/UIKit-1914.84/UIDocumentInteractionController.m:1094
2012-05-05 21:55:36.848 InstantFrame[855:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController: invalid scheme (null).  Only the file scheme is supported.'

Instagram will be opened but does not import anything.

like image 472
iOS.Lover Avatar asked May 05 '12 16:05

iOS.Lover


People also ask

How do you open a picture on Instagram?

Tap or in the top right of Feed. Tap the blue play button beside the chat name in your Chats list. You can also tap a chat name to open the conversation, then tap View Photo or Play Video.

How do you open full size pictures on Instagram?

To view full-size Instagram photos, log into Instagram in a browser, visit the user's profile, and open the photo that you want to see full-sized. In the address bar, append media/? size=l to the end of the URL. Hit Enter to see the picture in full size.

How can I search with image on Instagram?

To use it from a desktop or mobile browser, access the site and click on the Images button under the search bar. The search bar will allow you to paste an image's URL or upload it. Google will tie the image to a possible related search term to widen the results and then show you every instance of the picture it finds.


1 Answers

What you want to do is open a specially formatted url.

Here is the instragram documentation i found with a quick google search:

http://instagr.am/developer/iphone-hooks/

Here is the apple docs that describes the url scheme process. http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007891-SW1

like image 66
scord Avatar answered Oct 18 '22 10:10

scord