mokesmokes / titanium-ios-facebook

Titanium iOS Facebook Module
Other
48 stars 17 forks source link

FB.share doesn't work #18

Closed kopiro closed 9 years ago

kopiro commented 9 years ago

I configured the tiapp.xml:

            <key>FacebookAppID</key>
            <string>XXXXX</string>
            <key>FacebookDisplayName</key>
            <string>XXXXXXX</string>
            <key>CFBundleURLTypes</key>
            <array>
                <dict>
                    <key>CFBundleURLName</key>
                    <string>XXXXXXXXXX</string>
                    <key>CFBundleURLSchemes</key>
                    <array>
                        <string>XXXXXX</string>
                        <string>fbXXXXXXXXX</string>
                    </array>
                </dict>
            </array>

But

Ti.API.debug(FB.getCanPresentShareDialog());
Ti.API.debug(FB.share());

FB.getCanPresentShareDialog() returns false.

and FB.share() simply doesn't work.

Any advice?

svenne87 commented 9 years ago

I have the same issue.

mokesmokes commented 9 years ago

Is the Facebook app installed?

svenne87 commented 9 years ago

I have it installed on device and the "application" on the Facebook developer page is active (read that it could have something to do with that as well).

kopiro commented 9 years ago

Yes, FB installed and app right configured (without sandbox mode).

mokesmokes commented 9 years ago

To be clear: Facebook by Facebook, Inc. https://appsto.re/il/NuV-q.i is installed?

kopiro commented 9 years ago

Yes, yes :D

mokesmokes commented 9 years ago

Please post your entire tiapp.xml here, or email it to me (mokesmokes gmail com). Also, make sure the FacebookDisplayName is exactly as you configured on Facebook app settings. Normally, getCanPresentShareDialog() returns false if the FB app is not installed, and of course then you cannot share. The Share Dialog is a FB app feature, and thus for example you can't use it on a simulator, etc.

BTW - does login work for you? What is the login method used - system dialog, Safari login, or Facebook app?

svenne87 commented 9 years ago

I sent an email with the entire xml.

And yes the FacebookDisplayName is the same as in Facebook settings and yeah that I know. Spent some time trying to find answers in Facebook doc's and such. Well that's the thing I use the default method to login (so app login with a fallback to webview) and I also you the requestWithGraph to get invitable friends, that all works fine. Just the share that is an issue.

mokesmokes commented 9 years ago

@svenne87 In this particular case did the login occur via the FB app?

svenne87 commented 9 years ago

Yes

kopiro commented 9 years ago

Le voilà:

<?xml version="1.0" encoding="UTF-8"?><ti:app xmlns:ti="http://ti.appcelerator.org">
<id>com.caffeinalab.test</id>
<name>CTA</name>
<version>1.0</version>
<publisher>not specified</publisher>
<url>http://caffeinalab.com</url>
<description>not specified</description>
<copyright>not specified</copyright>
<icon>appicon.png</icon>
<fullscreen>false</fullscreen>
<navbar-hidden>false</navbar-hidden>
<analytics>false</analytics>
<guid>75d838c0-e06a-4fe2-822d-7d55f1f9d661</guid>
<property name="ti.ui.defaultunit" type="string">dp</property>
<property name="ti.facebook.appid" type="string">531647583566753</property>
<ios>
    <plist>
        <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>FacebookAppID</key>
            <string>531647583566753</string>
            <key>FacebookDisplayName</key>
            <string>caffeina-test-app</string>
            <key>CFBundleURLTypes</key>
            <array>
                <dict>
                    <key>CFBundleURLName</key>
                    <string>com.caffeinalab.test</string>
                    <key>CFBundleURLSchemes</key>
                    <array>
                        <string>cta</string>
                        <string>fb531647583566753</string>
                    </array>
                </dict>
            </array>
        </dict>
    </plist>
</ios>
<android xmlns:android="http://schemas.android.com/apk/res/android">
</android>
<deployment-targets>
    <target device="android">false</target>
    <target device="blackberry">false</target>
    <target device="ipad">false</target>
    <target device="iphone">true</target>
    <target device="mobileweb">false</target>
    <target device="tizen">false</target>
</deployment-targets>
<modules>
    <module>com.facebook</module>
</modules>
<sdk-version>3.4.0.GA</sdk-version>
<plugins><plugin version="1.0">ti.alloy</plugin>
</plugins>
</ti:app>
mokesmokes commented 9 years ago

@kopiro as @svenne87 did, can you email me screenshots of the Facebook app settings, both Basic and Advanced screens? Thanks.

mokesmokes commented 9 years ago

One more thing: It's fb.share({}) at least, you must pass an object, please see the README again.

kopiro commented 9 years ago

http://cl.ly/image/0P3t1R160q0r http://cl.ly/image/0m3k2m0l3Y33 http://cl.ly/image/2K3d0g2f0L3F

Yes, I tried both with fb.share({ url: 'http://google.it' })

mokesmokes commented 9 years ago

@kopiro you definitely have one issue: your FacebookDisplayName on Facebook is CTA.... please update your tiapp.xml to show CTA instead of caffeina-test-app and rebuild your app.......

<key>FacebookDisplayName</key>
<string>CTA</string>
mokesmokes commented 9 years ago

@kopiro please update us if this fixes your problem :)

kopiro commented 9 years ago

Oh, it was just a test.. initially was "CTA" but it doesn't works btw :+1:

mokesmokes commented 9 years ago

should be closed by 3.20.02

kopiro commented 9 years ago

Yees, it works! BTW, FB.getCanPresentShareDialog() is always false

mokesmokes commented 9 years ago

@kopiro if FB.getCanPresentShareDialog() were always false then the sharing would never work. Take a look at https://github.com/mokesmokes/titanium-ios-facebook/blob/master/Classes/ComFacebookModule.m#L263 and https://github.com/mokesmokes/titanium-ios-facebook/blob/master/Classes/ComFacebookModule.m#L476 I tried on an emulator and it always returns false since no FB app installed, and on my iPhone it returns true. How can you share if it's false? The same check exists in FB.getCanPresentShareDialog() and in the share method