6.8 C
New York
Friday, November 15, 2024

ios – load photograph or video to Instagram feed composer – flutter


I am attempting to cross photographs and movies to the Instagram app from the flutter primarily based app. The Instagram app will obtain this content material and cargo it within the feed composer so the Person can publish it to their Instagram Feed.

Instagram Sharing to Feed

I could not discover a solution to do it in flutter app. I must particularly do it for IOS in flutter app. To date, I capable of finding out that it must be executed utilizing Doc Interplay API which is offered in IOS

and that is the ios code that opens up Instagram feed composer with preloaded picture or video

@IBAction func sharePhotoAsFeed(_ sender: Any) {
  guard let imageInstagram = UIImage(named: "photograph.jpg") 
  else { return }
  let instagramURL = NSURL(string: "instagram://")
  if UIApplication.shared.canOpenURL(instagramURL! as URL) {
    let jpgPath = (NSTemporaryDirectory() as   
    NSString).appendingPathComponent("instagram.igo")
    do {
      attempt imageInstagram.jpegData(compressionQuality:
      0.75)?.write(to: URL(fileURLWithPath: jpgPath), choices:
      .atomic)
    } catch {
      print(error) 
      return
    }
    let rect = CGRect.zero
    let fileURL = NSURL.fileURL(withPath: jpgPath)
    documentInteractionController =   
    UIDocumentInteractionController()
    documentInteractionController.url = fileURL
    documentInteractionController.delegate = self
    documentInteractionController.uti =
    "com.instagram.exclusivegram"
    documentInteractionController.presentOpenInMenu(from: rect, in:  
    self.view, animated: true)
 } else {
   print("Sorry the applying just isn't put in")
 }
}

however I am questioning obtain this in flutter app?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles