【问题标题】:When i post image to instagram from my app it directly opens to filter section of Instagram but i want it to open cropping section of Instagram?当我从我的应用程序将图像发布到 Instagram 时,它会直接打开 Instagram 的过滤部分,但我希望它打开 Instagram 的裁剪部分?
【发布时间】:2016-02-15 07:07:00
【问题描述】:
- (IBAction)postToInstagram:(id)sender {
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];

if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
{
    CGRect rect = CGRectMake(0,0,0,0);
    NSString *jpgPath=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Home_1_instgram.igo"];
    UIImage *imageN = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@", jpgPath]];

    //        [UIImagePNGRepresentation(_imageDetail.image) writeToFile:jpgPath atomically:YES];
    NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@",jpgPath]];
    self.documentController.UTI = @"com.instagram.exclusivegram";

    self.documentController = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
    NSString *caption = self.catalogueImage.caption; //settext as Default Caption

    //Removing pre-filled captions from mobile sharing
    //http://developers.instagram.com/post/125972775561/removing-pre-filled-captions-from-mobile-sharing

    self.documentController.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];

    NSLog(@"caption: %@",caption);

    [self.documentController presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
}
else
{
    UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"INSTAGRAM NOT FOUND" message:@"Please install instagram to post to instagram." delegate:nil cancelButtonTitle:nil otherButtonTitles:@"ok", nil];
    [alert show];
}
}

【问题讨论】:

    标签: ios objective-c instagram


    【解决方案1】:

    我找到了解决方案。在 iOS 中,Instagram 直接将用户发送到过滤部分,而在 android 中,用户被定向到裁剪部分。它在 Instagram iPhone Hook 中被提及。 谢谢你

    【讨论】:

      【解决方案2】:

      我在你的代码中改变了一些东西:

      你应该使用com.instagram.photo

      - (IBAction)postToInstagram:(id)sender {
      
      if ([self schemeAvailable:@"instagram://app"])
      {
          CGRect rect = CGRectMake(0,0,0,0);
          NSString *jpgPath=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Home_1_instgram.igo"];
          UIImage *imageN = [UIImage imageNamed:@"IMG_1304.PNG"];
      
          [UIImagePNGRepresentation(imageN) writeToFile:jpgPath atomically:YES];
          NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@",jpgPath]];
          self.documentController.UTI = @"com.instagram.photo";
      
          self.documentController = [UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
          NSString *caption = @"YourCaption"; //settext as Default Caption
      
          //Removing pre-filled captions from mobile sharing
          //http://developers.instagram.com/post/125972775561/removing-pre-filled-captions-from-mobile-sharing
      
          self.documentController.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];
      
          NSLog(@"caption: %@",caption);
      
          [self.documentController presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
      }
      else
      {
          UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"INSTAGRAM NOT FOUND" message:@"Please install instagram to post to instagram." delegate:nil cancelButtonTitle:nil otherButtonTitles:@"ok", nil];
          [alert show];
        }
      }
      

      【讨论】:

      • 我仍然遇到同样的问题 Mohamad Frahand 我仍然进入 Instagram 的过滤器部分而不是裁剪部分
      • 但我已经在我的代码中尝试了您的操作,然后将其发送到这里!你能上传你的代码吗?
      • 我使用的是 NSURL 而不是 schemeAvailable,其他一切都是一样的 NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"]; if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
      • 我只添加了:LSApplicationQueriesSchemesinstagram 并将此操作称为我的兄弟。如果你愿意,你可以推送你的样本来尝试修复它。
      • CFBundleURLTypesCFBundleURLNamecom.instagram.exclusivegramCFBundleURLSchemescom.instagram.exclusivegramCFBundleVersion1LSApplicationCategoryTypeLSApplicationQueriesSchemesinstagram 当我将字符串更改为 com.instagram.exclusivegram 以拍照时,它只是将我带到了过滤器Instagram 的部分而不是 Instagram 中的裁剪部分
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-08-08
      • 1970-01-01
      • 1970-01-01
      • 2017-02-10
      • 2017-05-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多