赞
踩
设置url types
主应用修改info.list
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.MelissaShu.MSImagePick</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ms</string>
</array>
</dict>
</array>
键盘infolist
<key>LSApplicationQueriesSchemes</key> <array> <string>wechat</string> <string>weixin</string> <string>sinaweibohd</string> <string>sinaweibo</string> <string>sinaweibosso</string> <string>weibosdk</string> <string>weibosdk2.5</string> <string>openapp.jdmobile</string> <string>taobao</string> <string>tmall</string> <string>ms</string> //自建的应用url 对应主应用其他是打开别的app用的 <string>alipay</string> <string>alipayshare</string> </array>
调起代码
@objc func openURL(_ url: URL) { return } func openApp(_ urlstring:String) { var responder: UIResponder? = self as UIResponder let selector = #selector(openURL(_:)) while responder != nil { if responder!.responds(to: selector) && responder != self { responder!.perform(selector, with: URL(string: urlstring)!) return } responder = responder?.next } }
openApp( “ms://”) 就可以打开主应用了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。