我正在使用Appcelerator 4.9.1,钛SDK 6.1.2和Facebook模块5.4.0(最新),IOS 10.2.1,MacOS 10.11.6
在尝试分享内容时,Facebook的网页版本会打开,而不是应用。已经阅读了自Titanium 6.0.0版以来的所有指南和一些修复,但仍然是每次都是webview而不是应用程序。
我尝试重新审视在应用中实施Facebook的每一步。
我尝试使用Swift 3直接在Xcode中执行此操作
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func shareOnFacebook(_ sender: AnyObject) {
if SLComposeViewController.isAvailable(forServiceType: SLServiceTypeFacebook) {
let facebookShare: SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
facebookShare.setInitialText("Look at this great picture!")
facebookShare.add(UIImage(named: "genghis-khan.jpg")!)
facebookShare.add(URL(string: "https://mindware.com.mx"))
self.present(facebookShare, animated: true, completion: nil)
}
else{
let alert = UIAlertController(title: "Account", message: "Please login to a facebook account to share", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
}
现在提出以下内容,如何通过appcelerator实现这一目标? Facebook post dialog
下面的钛代码。
fb.presentShareDialog(
{
link: 'https://example.org',
title: 'Usual sharing operation'
});
这是tiapp.xml
<ti:app xmlns:ti="http://ti.appcelerator.org">
<id>org.example.appid</id>
<name>Ayuda Maistro</name>
<version>1.0.1</version>
<publisher>myusername</publisher>
<url>https://example.org</url>
<description>App para busqueda y contacto de trabajadores para hogar y oficina, mejor conocidos como maistros</description>
<copyright>2017 by xavieralfeiran</copyright>
<icon>appicon.png</icon>
<fullscreen>false</fullscreen>
<navbar-hidden>false</navbar-hidden>
<analytics>true</analytics>
<guid>0df83aa3-e4ee-4fd8-9333-b12255351f75</guid>
<property name="ti.ui.defaultunit" type="string">dp</property>
<property name="run-on-main-thread" type="bool">true</property>
<ios>
<enable-launch-screen-storyboard>false</enable-launch-screen-storyboard>
<use-app-thinning>true</use-app-thinning>
<plist>
<dict>
<key>NSLocationAlwaysUsageDescription</key>
<string>
Cenotes requiere tu ubicacion para mostrar las opciones cercanas
</string>
</dict>
<dict>
<key>NSCameraUsageDescription</key>
<string>
Foto para el maistro
</string>
</dict>
<dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>
Cenotes requiere tu ubicacion para mostrar las opciones cercanas
</string>
</dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<dict>
<key>UISupportedInterfaceOrientations~iphone</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIRequiresPersistentWiFi</key>
<false/>
<key>UIPrerenderedIcon</key>
<false/>
<key>UIStatusBarHidden</key>
<false/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<!-- Application ID same as the id value in the tiapp.xml file -->
<string>mx.com.mindware.maistros</string>
<key>CFBundleURLSchemes</key>
<array>
<!-- Prefix the Facebook App ID with 'fb' -->
<string>fb175100632968910</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>FacebookAppID</key>
<string>01010101010101</string>
<key>FacebookDisplayName</key>
<string>Ayuda Maistro</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<key>NSCalendarsUsageDescription</key>
<string>Advertisement would like to create a calendar event.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Advertisement would like to store a photo.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Advertisement would like to use the microphone.</string>
<key>NSAppleMusicUsageDescription</key>
<string>Advertisement would like to query your music library.</string>
</dict>
</plist>
</ios>
<android xmlns:android="http://schemas.android.com/apk/res/android"/>
<mobileweb>
<precache/>
<splash>
<enabled>true</enabled>
<inline-css-images>true</inline-css-images>
</splash>
<theme>default</theme>
</mobileweb>
<modules>
<module platform="commonjs">ti.cloud</module>
<module platform="iphone">dk.napp.drawer</module>
<module platform="android">facebook</module>
<module platform="iphone">facebook</module>
<module platform="iphone">com.omorandi</module>
<module platform="iphone">bencoding.securely</module>
<module platform="android">bencoding.securely</module>
</modules>
<deployment-targets>
<target device="android">true</target>
<target device="ipad">true</target>
<target device="iphone">true</target>
<target device="mobileweb">false</target>
</deployment-targets>
<sdk-version>6.1.2.GA</sdk-version>
<plugins>
<plugin version="1.0">ti.alloy</plugin>
</plugins>
<property name="appc-app-id" type="string">5876c5577ac14b482657f078</property>
<property name="acs-authbase-url-development" type="string">https://secure-identity.cloud.appcelerator.com</property>
<property name="acs-base-url-development" type="string">https://api.cloud.appcelerator.com</property>
<property name="acs-oauth-secret-development" type="string">ZceAWJMxRm9yJAw5bZaTBv3OZEik8R3X</property>
<property name="acs-oauth-key-development" type="string">btB9fHLlV3Tpg6LBAduDUGvw8UvJmr9u</property>
<property name="acs-api-key-development" type="string">M8gXeJP5g3y7Cx0qz1Vmm8K4scrdeCfG</property>
<property name="acs-username-development" type="string">appc_app_user_dev</property>
<property name="acs-password-development" type="string">WWcOMANxIGZhgctMyt</property>
<property name="acs-authbase-url-production" type="string">https://secure-identity.cloud.appcelerator.com</property>
<property name="acs-base-url-production" type="string">https://api.cloud.appcelerator.com</property>
<property name="acs-oauth-secret-production" type="string">FIK1V2R5TdOxbVfVT8H23I0QAX2LakVp</property>
<property name="acs-oauth-key-production" type="string">nih1B6eEWaT9WfWr3bLJPEViqnO0jQSq</property>
<property name="acs-api-key-production" type="string">38RjD4LsKqh60zjLPontOjFTT6uX6FmJ</property>
<property name="acs-username-production" type="string">appc_app_user</property>
<property name="acs-password-production" type="string">E8Q4dWf5Ox8XG0ncup</property>
<property name="appc-org-id" type="string">100012327</property>
<property name="appc-creator-user-id" type="string">f8b4c614-11df-4a05-ad92-9612c8f0c9dc</property>
</ti:app>
我甚至在Safari中退出了Facebook,但没有运气