如何通过点击Swift中的按钮打开fb和instagram应用程序

编程入门 行业动态 更新时间:2024-10-25 12:16:10
本文介绍了如何通过点击Swift中的按钮打开fb和instagram应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何通过点击Swift中的按钮打开Facebook和instagram应用程序?在某些应用程序中,通过点击重定向到Facebook应用程序的东西并打开一些页面。如何在Swift中做同样的事情?

How can I open facebook and instagram app by tapping on button in Swift? In some apps by tapping on something it redirects to the facebook app and opens some page. How can I do the same thing in Swift?

我发现了,

var url = NSURL(string: "itms://itunes.apple/de/app/x-gift/id839686104?mt=8&uo=4") if UIApplication.sharedApplication().canOpenURL(url!) { UIApplication.sharedApplication().openURL(url!) }

但这里我必须知道一个应用程序的URL。其他例子在ObjC中,我根本不知道= /

but here I must to know an app URL. And other examples was in ObjC, which I do not know at all =/

推荐答案

看看这些链接,它可以帮助您:

Take a look on these links, it can help you:

https ://instagram/developer/mobile-sharing/iphone-hooks/

wiki.akosma/IPhone_URL_Schemes

在iOS上打开Facebook应用程序的Facebook链接

否则有一个Instagram的例子,用于打开特定的个人资料(昵称:johndoe here):

Otherwise there is a quick example with Instagram for opening a specific profile (nickname : johndoe here) :

var instagramHooks = "instagram://user?username=johndoe" var instagramUrl = NSURL(string: instagramHooks) if UIApplication.sharedApplication().canOpenURL(instagramUrl!) { UIApplication.sharedApplication().openURL(instagramUrl!) } else { //redirect to safari because the user doesn't have Instagram UIApplication.sharedApplication().openURL(NSURL(string: "instagram/")!) }

更多推荐

如何通过点击Swift中的按钮打开fb和instagram应用程序

本文发布于:2023-11-23 14:43:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621822.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   按钮   Swift   instagram   fb

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!