Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9152851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:09:20+00:00 2026-06-17T12:09:20+00:00

I am trying to export a photo from my application to Instagram, using this

  • 0

I am trying to export a photo from my application to Instagram, using this code:

// Capture Screenshot
UIGraphicsBeginImageContextWithOptions(self.view.frame.size,self.view.opaque,0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
NSString  *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/test.igo"];
NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", jpgPath]];
dic = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:igImageHookFile]];
dic.UTI = @"com.instagram.photo";
dic.annotation = [NSDictionary dictionaryWithObject:@"my caption" forKey:@"InstagramCaption"];
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
  [[UIApplication sharedApplication] openURL:instagramURL];
} else {
  NSLog(@"No Instagram Found");
}

But it is not working. It crashes with the following error:

2013-01-19 20:40:41.948 Ayat[12648:c07] * Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘* -[NSURL initFileURLWithPath:]: nil string parameter’

I am not sure I’m properly:

1- Saving jpgpath as the screenshot I took .

2- Passing the “dic” document to Instagram.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:09:21+00:00Added an answer on June 17, 2026 at 12:09 pm

    In my app, I have also export photo to Instagram. (Image must be larger than 612×612 size)
    Try this code:

    -(void)shareImageOnInstagram:(UIImage*)shareImage
    {
        //Remember Image must be larger than 612x612 size if not resize it.   
    
        NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
    
        if([[UIApplication sharedApplication] canOpenURL:instagramURL])
        {
            NSString *documentDirectory=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
            NSString *saveImagePath=[documentDirectory stringByAppendingPathComponent:@"Image.ig"];
            NSData *imageData=UIImagePNGRepresentation(shareImage);
            [imageData writeToFile:saveImagePath atomically:YES];
    
            NSURL *imageURL=[NSURL fileURLWithPath:saveImagePath];
    
            UIDocumentInteractionController *docController=[[UIDocumentInteractionController alloc]init];
            docController.delegate=self;
            [docController retain];
            docController.UTI=@"com.instagram.photo";
    
            docController.annotation=[NSDictionary dictionaryWithObjectsAndKeys:@"Image Taken via @App",@"InstagramCaption", nil];
    
            [docController setURL:imageURL];
    
    
            [docController presentOpenInMenuFromBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES];  //Here try which one is suitable for u to present the doc Controller. if crash occurs
    
        }
        else
        {
            NSLog (@"Instagram not found");
    
        }
    
    }
    

    I hope this will helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to export a screen shot from my application to Facebook using
I am trying to export an image from Flex application to svg. I saw
I am trying to export a snapshot of a movie using Quicktime. This is
I am trying to export biometric data from an analysis using the ROCR package.
I'm trying to export XML data from a web page to a spreadsheet using
I'm trying to export my Android application from Eclipse, and so I'm stuck at
I'm trying to export my java application to a Runnable Jar file. This worked
Hi I am trying Export data to excel sheet from GridView but having this
I am trying to export from a partitioned hive table into mysql using sqoop.
I have been trying to export the charts from Excel as an image file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.