Search code examples
iosswiftinstagraminstagram-api

open instagram post iPhone hook stopped working


In order to open instagram app with certain post I'm using following code:

func instaOpen(_ postId: String, _ postUrl: String){

    let appURL = URL(string: "instagram://media?id=\(postId)")!

    if UIApplication.shared.canOpenURL(appURL) {
        UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
    } else {
        // if Instagram app is not installed, open URL inside Safari
        let webURL = URL(string: postUrl)!
        let svc = SFSafariViewController(url: webURL)
        present(svc, animated: true, completion: nil)
    }
}

When instaOpen function called – instagram app opens, but login prompt forcefully pops over. Not matter what you do - close it or proceed with login, the queried post simply won't open(see gif). This started happening recently, after I've updated my app and pushed deployment target to iOS12.

I do have instagram listed in my LSApplicationQueriesSchemes as well as I'm 100% positive that correct mediaID is being passed to instaOpen func (the code worked previously).

issue

Let me know if there's any suggestions on how to fix this and actually open instagram post in instagram app.


Solution

  • Updated - Facebook developer fixed the issue.

    Its instagram bug you can follow its progress from https://developers.facebook.com/support/bugs/290173615155052/?disable_redirect=0