ios - 允许来 self 的应用程序的用户 'Follow on Instagram' (Swift)

标签 ios swift instagram

我想将用户的 Instagram 帐户连接到我的应用程序,并能够让他们在 Instagram 上关注其他用户(她/他选择的);或者至少触发 Instagram 应用程序并转到用户的个人资料。我目前正在使用 Swift,那里的文档不是很清楚。真的可以做我想做的事吗?如果是这样,我该怎么做?预先感谢您的帮助。

最佳答案

这个函数将完成这项工作:

如果没有安装instagram app,那么它会在safari中打开instagram的网页。 如果安装了该应用程序,它会在 Instagram 应用程序中打开您想要的页面:)

func openInstagram() {


    var instURL: NSURL = NSURL (string: "instagram://user?username=Instagram")! // Replace = Instagram by the your instagram user name
    var instWB: NSURL = NSURL (string: "https://instagram.com/instagram/")! // Replace the link by your instagram weblink

    if (UIApplication.sharedApplication().canOpenURL(instURL)) {
        // Open Instagram application
        UIApplication.sharedApplication().openURL(instURL)
    } else {
        // Open in Safari
        UIApplication.sharedApplication().openURL(instWB)


    }
}

关于ios - 允许来 self 的应用程序的用户 'Follow on Instagram' (Swift),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29755059/

相关文章:

ios - 将 ARFaceGeometry 实时 AR 数据捕获到自定义 Metal 管道

ios - 检查 SKCameraNode View 是否包含某个类的节点?

ios - 使用自定义布局重新加载 UICollectionView 会引发错误

javascript - Instagram API : getting users feed from another site

ios - 将下载的图像从 url 设置为 Imageview - IoS

ios - Swift 位置返回 nil

ios - 原始类型的枚举不能有带参数的案例

swift 。结合。重试时,有什么方法可以多次调用发布者 block ?

ruby - 使用 Facebook 帐户登录 Instagram oAuth

ios - 获取 Unfollower Instagram api swift