简体   繁体   English

发布链接到Facebook,包括应用程序URL方案 - iOS 6

[英]Post link to Facebook including app URL scheme - iOS 6

I'm using the UIActivityViewController to share an image and url from within my app. 我正在使用UIActivityViewController从我的应用程序中共享图像和网址。 I'm having trouble formatting the facebook post. 我在格式化facebook帖子时遇到了麻烦。 I attach an image using a subclassed UIActivityItemProvider and provide the text for the post in the same way. 我使用子类UIActivityItemProvider附加图像,并以相同的方式为帖子提供文本。

I want to add a url, but it needs my apps custom url scheme in front of it like this myurl://image?url=http://imageurl.com 我想添加一个网址,但它需要我的应用程序自定义网址方案,就像这样myurl://image?url=http://imageurl.com

The problem is, when this is posted, only the last half of the url is clickable (from http:// onwards). 问题是,当发布时,只有网址的后半部分是可点击的(从http://开始)。 Which means it doesn't open my app with the url. 这意味着它无法使用网址打开我的应用。

Is there another way to do this? 还有另一种方法吗? I know I can create an app on Facebook, but how can I tie the two together using the UIActivityViewController ? 我知道我可以在Facebook上创建一个应用程序,但是如何使用UIActivityViewController将两者结合在一起?

Thanks 谢谢

You have 2 options : 你有2个选择:

  1. Create a simple server-side web service that will redirect from http://yourserver.com/linkToApp/image to myurl://image . 创建一个简单的服务器端Web服务,该服务将从http://yourserver.com/linkToApp/image重定向到myurl://image
    It could even show a different page/preview if the app is not installed/if you're not on an ios device. 如果未安装应用程序/如果您不在ios设备上,它甚至可以显示不同的页面/预览。

  2. Create a facebook app and use "Deep linking" (it will basically do the same for you..) 创建一个Facebook应用程序并使用“深层链接”(它基本上会为你做同样的事情..)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM