jeduan / cordova-plugin-facebook4

Use the latest Facebook SDK in your Cordova and Ionic projects
Other
765 stars 511 forks source link

Not working on iOS, whilst working on Android #791

Closed danieldanielecki closed 5 years ago

danieldanielecki commented 5 years ago

With exactly the same codebase I have perfectly working Facebook events on Android. However, on iOS it doesn't works. Tried to get an answer on Stack Overflow by asking this question as well as on HTML5 Game Devs by asking here. Unfortunately, no one helped there.

As you can see from these links my codebase is as follows:

this.options = {
    method: 'apprequests',
    message: 'Play YellowSidd with me!'
};
this.onSuccess = function(result) {
   alert("Success with invite, result: " + result);
};
this.onError = function(msg) {
   alert("Failed with invite, msg: " + msg);
};

facebookConnectPlugin.showDialog(this.options, this.onSuccess, this.onError);

This does works perfectly fine on Android, whilst on iOS not. Basically, I can't see any error from these alerts, it looks like there is no reaction at all. Tried to modify Build Phases -> Compile Sources, as well as Build Phases -> Link Binary with Libraries in Xcode, but nothing helped. Tested on real device iPad Pro 9.7, iOS 12.3.1, after the app has been submitted, as well as on TestFlight. Tested on 2 different application, no one worked out. I tried to debug this using Apple Developer Bug Report - Profiles and Logs and Console, but couldn't find anything. Maybe a tip what shall I look for in these logs would be also very much appreciated!

danieldanielecki commented 5 years ago

Still can't get it working, my logs on a freshly generated project are as follows:

SpringBoard Loaded extension com.facebook.Facebook.NotificationContentExtension for categories [ campaign_close_friend_activity, campaign_comment_mention, campaign_feed_comment, campaign_feed_comment_reply, campaign_friend, campaign_friend_confirmed, campaign_group_comment_reply, campaign_mentions_comment, follow_video_page, friend_plain_view, groups_you_should_join, pages_you_may_like, top_trending_video, msg, wall, friend, poke, relationship_req, photo_tag, general_invite, photo_comment, note_tag, photo_album_download, photo_album_comment, note_comment, share_comment, event_cancel, photo_reply, photo_comment_tagged, note_reply, share_reply, photo_album_reply, group_r2j, group_report_to_admin, group_proactive_report_to_admin, group_report_to_facebook, added_to_group_reminder, groups_preview_invite, photo_tag_request, status_tag_request, status_tagged_by_non_owner, phonebook_accept, birthday_reminder, birthday_early, birthday_late, friend_confirmed, friend_request_reminder, friend_request_reminder_async, phonebook_request, video_tag, video<…> ] with attributes: <decode: missing data>
SpringBoard Loaded extension com.facebook.Facebook.NotificationContentExtension for categories [ campaign_close_friend_activity, campaign_comment_mention, campaign_feed_comment, campaign_feed_comment_reply, campaign_friend, campaign_friend_confirmed, campaign_group_comment_reply, campaign_mentions_comment, follow_video_page, friend_plain_view, groups_you_should_join, pages_you_may_like, top_trending_video, msg, wall, friend, poke, relationship_req, photo_tag, general_invite, photo_comment, note_tag, photo_album_download, photo_album_comment, note_comment, share_comment, event_cancel, photo_reply, photo_comment_tagged, note_reply, share_reply, photo_album_reply, group_r2j, group_report_to_admin, group_proactive_report_to_admin, group_report_to_facebook, added_to_group_reminder, groups_preview_invite, photo_tag_request, status_tag_request, status_tagged_by_non_owner, phonebook_accept, birthday_reminder, birthday_early, birthday_late, friend_confirmed, friend_request_reminder, friend_request_reminder_async, phonebook_request, video_tag, video<…> ] with attributes: <decode: missing data>
SpringBoard Setting topics for environment production:
enabled: (
)
ignored: (
)
opportunistic:(
    "xyz.app1...",
    "xyz.app2...",
    "xyz.app3...",
    "...",
    "xyz.appX..."
[com.facebook.Messenger] Got section info [ enabled: 1 ]
HelloCordova    <Warning>: Please set a value for FacebookAutoLogAppEventsEnabled. Set the flag to TRUE if you want to collect app install, app launch and in-app purchase events automatically. To request user consent before collecting data, set the flag value to FALSE, then change to TRUE once user consent is received. Learn more: https://developers.facebook.com/docs/app-events/getting-started-app-events-ios#disable-auto-events.
HelloCordova    <Warning>: You haven't set a value for FacebookAdvertiserIDCollectionEnabled. Set the flag to TRUE if you want to collect Advertiser ID for better advertising and analytics results. To request user consent before collecting data, set the flag value to FALSE, then change to TRUE once user consent is received. Learn more: https://developers.facebook.com/docs/app-events/getting-started-app-events-ios#disable-auto-events.
HelloCordova    Starting Facebook Connect plugin
HelloCordova    [CDVTimer][facebookconnectplugin] 
HelloCordova    [C3 graph.facebook.com:443 tcp, url hash: 947db370, tls] start
HelloCordova    new connection to graph.facebook.com config 0x281f6e040
HelloCordova    [C3 graph.facebook.com:443 tcp, url hash: 947db370, tls] cancel
HelloCordova    [C3 graph.facebook.com:443 tcp, url hash: 947db370, tls] cancelled

With the config.xml:

<plugin name="cordova-plugin-facebook4" spec="5.0.0">
  <params>
    <param name="APP_ID" value="XXX" />
    <param name="APP_NAME" value="XXX" />
  </params>
</plugin>

The version 5.0.0 is intentionally due to the reason it doesn't compile on 6.0.0. I'm on cordova-ios 5.0.1.

Am I missing maybe something in the package.json in dependencies?

{
  "name": "hellocordova",
  "displayName": "HelloCordova",
  "version": "1.0.0",
  "description": "A sample Apache Cordova application that responds to the deviceready event.",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "ecosystem:cordova"
  ],
  "author": "Apache Cordova Team",
  "license": "Apache-2.0",
  "dependencies": {
    "cordova-admob-sdklibs": "^2.1.6",
    "cordova-ios": "^5.0.1",
    "cordova-plugin-admob-simple": "^3.3.8",
    "cordova-plugin-facebook4": "5.0.0",
    "cordova-plugin-inappbrowser": "^3.1.0",
    "cordova-plugin-purchase": "^8.1.1",
    "cordova-plugin-statusbar": "^2.4.3",
    "cordova-plugin-x-socialsharing": "^5.6.0",
    "cordova-plugin-whitelist": "^1.3.4",
    "es6-promise-plugin": "^4.2.2"
  },
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-facebook4": {
        "APP_ID": "242231026115859",
        "APP_NAME": "YellowSidd",
        "FACEBOOK_HYBRID_APP_EVENTS": "false",
        "FACEBOOK_ANDROID_SDK_VERSION": "5.0.2"
      },
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-purchase": {},
      "cordova-plugin-admob-simple": {},
      "cordova-plugin-x-socialsharing": {
        "PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION": "This app requires photo library access to function properly.",
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "This app requires photo library access to function properly."
      },
      "cordova-plugin-statusbar": {}
    },
    "platforms": [
      "ios"
    ]
  }
}

EVERYTHING (including all plugins) else is working fine...

danieldanielecki commented 5 years ago

Really nasty bug in this plugin, definitely documentation could be better. Nevertheless, for apprequests method an actionType is required as issue#110 (comment) and issue#531 (comment) state.

Final code:

this.options = {
  actionType: '',
  method: 'apprequests',
  message: 'Play YellowSidd with me!'
};

Edit: It looks like the actionType is required only by iOS, because on Android it does works without it.

peterpeterparker commented 5 years ago

@danieldanielecki cool to hear it worked out 👍

could you provide a PR for the documentation?

danieldanielecki commented 4 years ago

@peterpeterparker done, please check PR#882

peterpeterparker commented 4 years ago

@danieldanielecki thanks Daniel, however since a couple of months I gave up being a maintainer of this plugin