Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23521] Ti.Facebook - presentShareDialog does not open native app, only webview

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-09-11T16:56:36.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.0
ComponentsAndroid, iOS
Labelsti.facebook
ReporterBe Rushton
AssigneeHans Knöchel
Created2016-06-06T07:55:02.000+0000
Updated2016-09-16T22:02:48.000+0000

Description

The facebook module does not open the native share dialog, it only opens the web version in a webview. It should open the sharesheet ie. https://developers.facebook.com/docs/sharing/ios Code to reproduce is standard boilerplate from the docs: fb.presentShareDialog({ link: 'https://appcelerator.com/', title: 'great product', description: 'Titanium is a great product', picture: 'http://www.appcelerator.com/wp-content/uploads/scale_triangle1.png' });

Comments

  1. Nazmus Salahin 2016-06-06

    Hello, Thanks for reporting. Native share dialog will not be opened if Facebook app is not installed in the device. So, please make sure that Facebook app is installed in the device and let us know. Thanks in advance
  2. Be Rushton 2016-06-06

    Doesn't matter if native app is installed or not.
  3. Be Rushton 2016-06-06

    Facebook changed the way a lot of their code worked when iOS 9 came out last year. Older versions of the module still open the native app but things changed in the newer Facebook sdk
  4. Hans Knöchel 2016-07-18

    Similar to the login-process, the native Facebook SDK on iOS 9+ decides internally which behavior to use. Since the app-switching in iOS9+ requires the user to confirm the switch, they (currently) prefer opening the safari-dialog for those operations. We follow their best-practices, so if you see it as an issue, please follow-up with Facebook. Thanks!
  5. Be Rushton 2016-07-18

    Could you give us the option please? Not everyone agrees with the current behaviour. It was available previously and we need to maintain the currently functionality of existing applications.
  6. Hans Knöchel 2016-07-18

    As said before, we cannot change Facebook's internal decisions and behavior. I am not sure how I can help you while being restricted by the Facebook SDK.
  7. Be Rushton 2016-07-18

    Yeah I can see where you are coming from. There does seem to be some ways around it though like this one http://stackoverflow.com/a/35732372/568754. There is plenty of people that disagree with the change. If these workarounds aren't an option is there a way to use an older Facebook SDK? Will the old ti.facebook versions work or has there been too many bug fixes to get them working on Ti 5.3.1.GA and above?
  8. Hans Knöchel 2016-07-18

    UPDATE: Actually, I found a way to configure the dialog. There is a property mode that we could possibly set. I wrapped up a PR here which I'd like you to test: PR: https://github.com/appcelerator-modules/ti.facebook/pull/58 Release (iOS): https://github.com/appcelerator-modules/ti.facebook/releases/tag/ios-5.2.1 Release (Android): https://github.com/appcelerator-modules/ti.facebook/releases/tag/android-6.0.1 Demo:
       var fb = require("ti.facebook");
       fb.initialize();
       fb. presentShareDialog({
           title: "Appc rocks!"
           link: "http://appcelerator.com",
           mode: fb.SHARE_DIALOG_MODE_AUTOMATIC
       });
       
  9. Hans Knöchel 2016-08-01

    PR's merged, titanium_mobile updated.
  10. Lokesh Choudhary 2016-09-02

    Verified the fix. The mode property works fine on android. Environment: Appc Studio : 4.8.0.201608221113 Ti SDK : 6.0.0.v20160901034311 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.6 Appc NPM : 4.2.7 Appc CLI : 6.0.0-31 Node: 4.4.4 Nexus 6 - Android 6.0.1 Facebook Module : 6.0.1 On iOS: When I run with facebook iOS module 5.2.1, build fails with:
        [TRACE] :  ld: warning: directory not found for option '-F/Users/lchoudhary/Desktop/workspaces/new_test_workspace/test_proj/build/iphone/../../modules/iphone/facebook/5.3.0/platform'
        [TRACE] :  ld: warning: directory not found for option '-F/Users/lchoudhary/Library/Application Support/Titanium/modules/iphone/facebook/5.3.0/platform'
        [TRACE] :  ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/PrivateFrameworks/'
        [TRACE] :  ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/PrivateFrameworks/'
        [TRACE] :  ld: framework not found FBSDKCoreKit
        [TRACE] :  clang: error: linker command failed with exit code 1 (use -v to see invocation)
        [ERROR] :  ** BUILD FAILED **
        [ERROR] :  The following build commands failed:
        [ERROR] :  	Ld build/Intermediates/test_proj.build/Debug-iphoneos/test_proj.build/Objects-normal/arm64/test_proj normal arm64
        [ERROR] :  (1 failure)
        
    IOS facebook modules 5.2.2 & higher do not seem to have this issue & the mode property seems to work fine. Reopening as the fix is in 5.2.1 facebook module. Using: Xcode: 7.3.1 Iphone 6 - 9.3.5 IOS facebook module : 5.2.1 Appc Studio : 4.8.0.201608221113 Ti SDK : 6.0.0.v20160901034311 Appc CLI : 6.0.0-31
  11. Hans Knöchel 2016-09-02

    Thanks Lokesh! I would highly suggest to use MOD-2280 for 6.0.0 which not only includes an important fix but should also fix the above problem. [~cng] to discuss. Otherwise, I will backport it manually.
  12. Lokesh Choudhary 2016-09-02

    [~hansknoechel], facebook module 5.2.3 & 5.2.4 for IOS works fine. You can resolve the ticket after your discussion with [~cng].
  13. Chee Kiat Ng 2016-09-05

  14. Lokesh Choudhary 2016-09-16

    Verified the fix for IOS with 5.2.6 facebook module. Closing. Environment: Appc Studio : 4.8.0.201609061702 Ti SDK : 6.0.0.v20160915125929 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.6 Appc NPM : 4.2.8-6 Appc CLI : 6.0.0-44 Node: 4.4.4 Nexus 6 - Android 6.0.1

JSON Source