romatroskin / social_share_plugin

Social Share to Facebook and Instagram Flutter plugin.
BSD 2-Clause "Simplified" License
41 stars 86 forks source link

ios Share not working (Solution) #49

Closed parthvirani95 closed 1 year ago

parthvirani95 commented 3 years ago

This is not my issue but I attached a solution for @45minuto just because I can't reply to their quotations sorry for this Please refer to this StackOverflow solution https://stackoverflow.com/questions/26833348/uidocumentinteractioncontroller-share-via-instagram-and-only-instagram this issue is because of iOS 13 only support .ig Extention file based on this plugin sharing functions so for that, we need to change below i attached image Screenshot 2021-02-22 at 1 56 31 PM 1 so for changing this open xcode and find "instagramShare" and on that function change to like - (void)instagramShare:(NSString*)imagePath { NSError *error = nil; UIViewController* controller = [UIApplication sharedApplication].delegate.window.rootViewController; // [[NSFileManager defaultManager] moveItemAtPath:imagePath toPath:[NSString stringWithFormat:@"%@.igo", imagePath] error:&error]; NSURL *path; if (@available(iOS 13.0, *)) { [[NSFileManager defaultManager] moveItemAtPath:imagePath toPath:[NSString stringWithFormat:@"%@.ig", imagePath] error:&error]; path = [NSURL URLWithString:[NSString stringWithFormat:@"file://%@.ig", imagePath]]; } else { [[NSFileManager defaultManager] moveItemAtPath:imagePath toPath:[NSString stringWithFormat:@"%@.igo", imagePath] error:&error]; path = [NSURL URLWithString:[NSString stringWithFormat:@"file://%@.igo", imagePath]]; } _dic = [UIDocumentInteractionController interactionControllerWithURL:path]; _dic.UTI = @"com.instagram.exclusivegram"; if (![_dic presentOpenInMenuFromRect:CGRectZero inView:controller.view animated:TRUE]) { NSLog(@"Error sharing to instagram"); }; }

Screenshot 2021-02-22 at 2 02 19 PM 1

this solve my issue so i hope this will help and sorry for my english

romatroskin commented 1 year ago

Fixed.