允许用户 'Follow on Instagram' 来自我的应用 (Swift)
Allowing users 'Follow on Instagram' from my app (Swift)
我想将用户的 Instagram 帐户连接到我的应用程序,并能够让他们在 Instagram 上关注其他用户(s/he 选择的用户);或者至少触发 Instagram 应用程序并转到用户的个人资料。我目前正在使用 Swift 并且那里的文档不是很清楚。真的可以做我想做的事吗?如果是这样,我该怎么做?在此先感谢您的帮助。
这是来自 Instagram 的 ios 开发人员文档页面(您可以找到如何打开用户 Instagram 个人资料):https://instagram.com/developer/mobile-sharing/iphone-hooks/
可能对你有帮助的图书馆(连接用户账号,关注):https://github.com/shyambhat/InstagramKit
这个函数可以完成工作:
如果没有安装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)
}
}
我想将用户的 Instagram 帐户连接到我的应用程序,并能够让他们在 Instagram 上关注其他用户(s/he 选择的用户);或者至少触发 Instagram 应用程序并转到用户的个人资料。我目前正在使用 Swift 并且那里的文档不是很清楚。真的可以做我想做的事吗?如果是这样,我该怎么做?在此先感谢您的帮助。
这是来自 Instagram 的 ios 开发人员文档页面(您可以找到如何打开用户 Instagram 个人资料):https://instagram.com/developer/mobile-sharing/iphone-hooks/
可能对你有帮助的图书馆(连接用户账号,关注):https://github.com/shyambhat/InstagramKit
这个函数可以完成工作:
如果没有安装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)
}
}