Facebook Plugin Share Issues

In my case, when native Facebook app is installed on the device, when PluginFacebook::dialog process stared for share link, the native Facebook app dialog popups and can post the share link to Facebook. But the share callback is “cancelled” status.

When native Facebook app is not installed, web dialog popups. I can post the share link and can get the “success” callback status.

i update fb sdk.
can you use this sample to try again, thanks.

I could build the sample project but could not install it to a device due to the following problem.

/sdkbox-cocos2d-x-binary/sample_func.sh: line 64: ios-deploy: command not found

you can open ./cpp/proj.ios_mac/facebook_cpp.xcodeproj with xcode, build, run

Are you able to provide provide project files with cocos2d files?

The facebook_cpp.xcodeproj cannot find cocos2d.h files because it is not included.
I manually added cocos2d_libs.xcodeproj copied from another cocos project under facebook_cpp.xcodeproj but it still cannot find cocos2d library.
Thus, I cannot build the project.

have you clone this repo https://github.com/sdkbox/sdkbox-cocos2d-x-binary

±- sdkbox-cocos2d-x-binary
±- sdkbox-sample-facebook

I was cloning from https://github.com/sdkbox/sdkbox-sample-facebook.

So, this time, I cloned from https://github.com/sdkbox/sdkbox-cocos2d-x-binary

However, during installation for facebook sample, it blocks to download some files from Github after inputting my username and the password (both are correct) as follows:

remote: Permission to sdkbox/sdkbox-sample-facebook.git denied to MyGithubUserName.
fatal: unable to access ‘https://github.com/sdkbox/sdkbox-sample-facebook.git/’: The requested URL returned error: 403

try https https://github.com/sdkbox/sdkbox-sample-facebook.git

Hi,

I tried from the repo again.
This time, I could build, install and run the app.

I tried dialog link.

The result is as follows. So, the “Cancel” callback again.

2016-11-24 12:06:38.984 facebook_cpp-mobile[223:23975] ##FB onSharedCancel
2016-11-24 12:06:44.304 facebook_cpp-mobile[223:24283] plugin com.apple.share.Facebook.post invalidated

The FBSDKLog is as follows:
Events: [
{
“isImplicit” : true,
“event” : {
“fb_dialog_outcome” : “Completed”,
“_logTime” : 1479956799,
“_eventName” : “fb_dialog_share_result”,
“_implicitlyLogged” : “1”,
“_ui” : “SLComposeViewController”
}
}
]

I used my own facebook app id and info.plist because your sample data is limited for your own test users.
If you could add my facebook id as the test user of the fb sample app, I may be able to test with your facebook app id and the included info.plist.

your facebook id?

Please check the message.

I tried with your facebook sample project with your project files and info.plist with my facebook id.
I could post using dialog link but the callback result was “share cancel” as follows.

2016-11-24 14:33:39.199 facebook_cpp-mobile[327:47673] ##FB onDialogLink
2016-11-24 14:33:40.489 facebook_cpp-mobile[327:47673] -canOpenURL: failed for URL: "fbapi20150629:/" - error: "This app is not allowed to query for scheme fbapi20150629"
2016-11-24 14:33:50.761 facebook_cpp-mobile[327:47673] ##FB onSharedCancel
2016-11-24 14:33:51.526 facebook_cpp-mobile[327:47673] FBSDKLog: FBSDKAppEvents: Flushed @ 1479965631, 3 events due to 'Timer' - {
    "advertiser_id" = "39B51BCF-F0B2- ";
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZF988076F-FBA0-43D5- ";
    "application_tracking_enabled" = 1;
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"com.sdkbox.sample.facebook.cpp\",\"1.0\",\"\",\"9.0\",\"iPod5,1\",\"ja_JP\",\"JST\",\"NoCarrier\",320,568,\"2.00\",2,13,6,\"Asia\\/Tokyo\"]";
    "url_schemes" = "[\"fb280194012150923\"]";
}
Events: [
  {
    "isImplicit" : false,
    "event" : {
      "fb_mobile_launch_source" : "Unclassified",
      "_session_id" : "9306334B-C012-40BA- ",
      "fb_mobile_app_interruptions" : 0,
      "_logTime" : 1479963009,
      "_ui" : "no_ui",
      "_eventName" : "fb_mobile_deactivate_app",
      "_valueToSum" : 20,
      "fb_mobile_time_between_sessions" : "session_quanta_3"
    }
  },
  {
    "isImplicit" : false,
    "event" : {
      "fb_mobile_launch_source" : "Unclassified",
      "_ui" : "no_ui",
      "_eventName" : "fb_mobile_activate_app",
      "_logTime" : 1479965616,
      "_session_id" : "1B550472-63F8-4E25- "
    }
  },
  {
    "isImplicit" : true,
    "event" : {
      "_ui" : "SLComposeViewController",
      "_eventName" : "fb_dialog_share_show",
      "fb_dialog_share_content_type" : "Status",
      "fb_dialog_mode" : "Automatic",
      "_logTime" : 1479965621,
      "_implicitlyLogged" : "1"
    }
  }
]
Flush Result : Success
2016-11-24 14:33:56.218 facebook_cpp-mobile[327:47832] plugin com.apple.share.Facebook.post invalidated
2016-11-24 14:34:05.965 facebook_cpp-mobile[327:47673] FBSDKLog: FBSDKAppEvents: Flushed @ 1479965646, 1 events due to 'Timer' - {
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZF988076F-FBA0-43D5- ";
    "application_tracking_enabled" = 1;
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"com.sdkbox.sample.facebook.cpp\",\"1.0\",\"\",\"9.0\",\"iPod5,1\",\"ja_JP\",\"JST\",\"NoCarrier\",320,568,\"2.00\",2,13,6,\"Asia\\/Tokyo\"]";
    "url_schemes" = "[\"fb280194012150923\"]";
}
Events: [
  {
    "isImplicit" : true,
    "event" : {
      "fb_dialog_outcome" : "Completed",
      "_logTime" : 1479965631,
      "_eventName" : "fb_dialog_share_result",
      "_implicitlyLogged" : "1",
      "_ui" : "SLComposeViewController"
    }
  }
]
Flush Result : Success

my console log:

2016-11-24 14:24:56.166 facebook_cpp-mobile[335:137287] ##FB onDialogLink
2016-11-24 14:24:56.304 facebook_cpp-mobile[335:137287] FBSDKLog: FBSDKAppEvents Persist: Writing 1 events
2016-11-24 14:24:56.323 facebook_cpp-mobile[335:137287] FBSDKLog: FBSDKTimeSpentData Persist: {"numInterruptions":1,"sessionID":"0D6DDF09-289D-43A1-BCE9-133269DA189E","secondsSpentInCurrentSession":20,"lastSuspendTime":1479968696}
2016-11-24 14:25:04.960 facebook_cpp-mobile[335:137287] FBSDKLog: FBSDKAppEvents Persist: Read 1 event states. First state has 1 events
2016-11-24 14:25:04.961 facebook_cpp-mobile[335:137287] FBSDKLog: FBSDKAppEvents Persist: Clearing
2016-11-24 14:25:04.963 facebook_cpp-mobile[335:137287] FBSDKShare didCompleteWithResults:{
    postId = "100010088083964_369105370102396";
}
2016-11-24 14:25:04.965 facebook_cpp-mobile[335:137287] ##FB onSharedSuccess:{"postId":"100010088083964_369105370102396"}
2016-11-24 14:25:06.021 facebook_cpp-mobile[335:137287] FBSDKLog: FBSDKTimeSpentData Restore: {"numInterruptions":1,"sessionID":"0D6DDF09-289D-43A1-BCE9-133269DA189E","secondsSpentInCurrentSession":20,"lastSuspendTime":1479968696}
2016-11-24 14:25:10.515 facebook_cpp-mobile[335:137287] FBSDKLog: FBSDKAppEvents: Flushed @ 1479968709, 2 events due to 'Timer' - {
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZ2F734197-9E82-4272-8FF4-EA2FA225C3F6";
    "application_tracking_enabled" = 1;
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"com.sdkbox.sample.facebook.cpp\",\"1.0\",\"\",\"9.3.3\",\"iPod5,1\",\"zh_CN\",\"GMT+8\",\"NoCarrier\",320,568,\"2.00\",2,27,22,\"Asia\\/Shanghai\"]";
    "url_schemes" = "[\"fb280194012150923\"]";
}
Events: [
  {
    "isImplicit" : true,
    "event" : {
      "fb_dialog_outcome" : "Completed",
      "_logTime" : 1479968705,
      "_eventName" : "fb_dialog_share_result",
      "_implicitlyLogged" : "1",
      "_ui" : "no_ui"
    }
  },
  {
    "isImplicit" : true,
    "event" : {
      "_implicitlyLogged" : "1",
      "_eventName" : "fb_dialog_share_show",
      "fb_dialog_share_content_type" : "Status",
      "fb_dialog_mode" : "Native",
      "_logTime" : 1479968696,
      "_ui" : "no_ui"
    }
  }
]
Flush Result : Success

did you test on dialog branch?

When I compare both logs, your “fb_dialog_mode” is “Native”. But mine is “Automatic”.

Do you have the native Facebook app on the same device?

yes, fb is installed, and dialog share link with fb native app.

you test with dialog branch?

change git workspace to dialog branch

git checkout dialog

I newly git cloned the dialog branch.

Built, ran and shared.

This time, the facebook app opened in the different process. However, the callback result was the same “share cancel”, unfortunately.

Following is the result of the log.

2016-11-24 16:11:15.519 facebook_cpp-mobile[389:62801] ##FB onDialogLink
2016-11-24 16:11:15.584 facebook_cpp-mobile[389:62801] FBSDKLog: FBSDKAppEvents Persist: Writing 1 events
2016-11-24 16:11:15.604 facebook_cpp-mobile[389:62801] FBSDKLog: FBSDKTimeSpentData Persist: {"numInterruptions":0,"sessionID":"F5F91509-DDD0-43D2-B2C3-FDBCACED6171","secondsSpentInCurrentSession":74,"lastSuspendTime":1479971476}
2016-11-24 16:11:36.201 facebook_cpp-mobile[389:62801] FBSDKLog: FBSDKAppEvents Persist: Read 1 event states. First state has 1 events
2016-11-24 16:11:36.201 facebook_cpp-mobile[389:62801] FBSDKLog: FBSDKAppEvents Persist: Clearing
2016-11-24 16:11:36.204 facebook_cpp-mobile[389:62801] FBSDKShare didCompleteWithResults:{
}
2016-11-24 16:11:36.213 facebook_cpp-mobile[389:62801] ##FB onSharedCancel
2016-11-24 16:11:37.169 facebook_cpp-mobile[389:62801] FBSDKLog: FBSDKTimeSpentData Restore: {"numInterruptions":0,"sessionID":"F5F91509-DDD0-43D2-B2C3-FDBCACED6171","secondsSpentInCurrentSession":74,"lastSuspendTime":1479971476}
2016-11-24 16:11:49.202 facebook_cpp-mobile[389:62801] FBSDKLog: FBSDKAppEvents: Flushed @ 1479971509, 2 events due to 'Timer' - {
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZ780FFCCB-D234-4CEE-B2FE-D1DE7163E407";
    "application_tracking_enabled" = 1;
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"com.sdkbox.sample.facebook.cpp\",\"1.0\",\"\",\"9.0\",\"iPod5,1\",\"ja_JP\",\"JST\",\"NoCarrier\",320,568,\"2.00\",2,13,6,\"Asia\\/Tokyo\"]";
    "url_schemes" = "[\"fb280194012150923\"]";
}
Events: [
  {
    "isImplicit" : true,
    "event" : {
      "fb_dialog_outcome" : "Completed",
      "_logTime" : 1479971496,
      "_eventName" : "fb_dialog_share_result",
      "_implicitlyLogged" : "1",
      "_ui" : "no_ui"
    }
  },
  {
    "isImplicit" : true,
    "event" : {
      "_implicitlyLogged" : "1",
      "_eventName" : "fb_dialog_share_show",
      "fb_dialog_share_content_type" : "Status",
      "fb_dialog_mode" : "Native",
      "_logTime" : 1479971476,
      "_ui" : "no_ui"
    }
  }
]
Flush Result : Success

By the way, I also tried the dialog photo menu. It shared a photo successfully but the callback was also “share cancel” this time.

can you dialog share link, cancel and show the log

Update!

I could finally get the “share success” result.

In the previous time, I did just Login > dialog link and the result was “share cancel”.

This time, I did login > requestPublishPermission > dialog link and the result was “share success”.

So, in the previous time, my operation of the app was not correct.

What would be the next step?
Are you going to merge the change of the dialog branch to the main branch of the SDKBOX facebook plugin?

yes, i will merge this change into main branch.

thank you very much.

Thank you for your work.
I appreciate it.

So, I re-checked user permission of our app, with the code below.

    std::vector<std::string> permissionLists = sdkbox::PluginFacebook::getPermissionList();
    
    for (int i = 0; i < permissionLists.size(); i++) {
        CCLOG("permissionLists.at(0):%d :%s",i, permissionLists.at(i).c_str());
    }

The result of the log is as follows:

permissionLists.at(0):0 :contact_email
permissionLists.at(0):1 :user_friends
permissionLists.at(0):2 :email
permissionLists.at(0):3 :public_profile
permissionLists.at(0):4 :publish_actions

So, I’m sure we get proper user permission to share link because we have “publish_actions” permission.