jeduan / cordova-plugin-facebook4

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

App ID not found. Add a string value with your app ID for the key FacebookAppID to the Info.plist or call [FBSDKSettings setAppID:] #817

Closed andyts93 closed 4 years ago

andyts93 commented 4 years ago

I get this error in an Ionic application when I call the login function. I've tried to remove and re-create the iOS platform but it doesn't solve the problem.

Cordova 9.0.0 Cordova-iOS 5.0.1 Plugin version 6.2.0

Here's my package.json cordova array

"cordova": {
    "plugins": {
      "cordova-plugin-camera": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-x-socialsharing": {
        "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
      },
      "cordova-plugin-file": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-qrscanner": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-file-opener2": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-inappbrowser": {},
      "com-sarriaroman-photoviewer": {},
      "cordova-plugin-badge": {},
      "cordova-plugin-firebasex": {
        "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
        "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
        "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true"
      },
      "cordova-plugin-facebook4": {
        "APP_ID": "XXXXXXXXX",
        "APP_NAME": "XXXXXXX",
        "FACEBOOK_HYBRID_APP_EVENTS": "false",
        "FACEBOOK_ANDROID_SDK_VERSION": "5.5.2"
      }
    },
uklawitter commented 4 years ago

Same here...

peterpeterparker commented 4 years ago

Could u provide a repo to reproduce the problem?

Also double check that you opened the .xcworkspace file as described in the doc https://github.com/jeduan/cordova-plugin-facebook4/tree/master/docs/ios

andyts93 commented 4 years ago

@peterpeterparker Yes I'm using the .xcworkspace file. I've found out that it was a problem of incompatibility with the plugin cordova-plugin-firebasex, I've replaced it with cordova-plugin-fcm-with-dependecy-updated to solve it

peterpeterparker commented 4 years ago

Cool happy to hear you resolved your issue 👍

iconio commented 4 years ago

Any chance to re-open this issue? I'm having the same problem and can't find any solutions. In my case I'm not using firebasex.

Thanks

ehdez82 commented 4 years ago

Same error, without using cordova-plugin-firebasex.

ryaa commented 4 years ago

The problem seems to be caused by the fact that some params (FacebookAppID etc.) are not added to the appropriate plist file and not available when the app is running. For example, these must be present in /platforms/ios//-Info.plist

The problem is that some cordova plugins (for example, cordova-plugin-facebook4, cordova-plugin-googleplus etc.) use config-file tag in plugin.xml to update your *-Info.plist file and due to the bug in cordova (see https://github.com/apache/cordova-common/issues/88) those changes are applied to the wrong plist file and not working.

The dirty and quick fix is to change the below line at 179 in /node_modules/cordova-common/src/ConfigChanges/ConfigFile.js file from

var plistName = getIOSProjectname(project_dir) + '-Info.plist';

to

var plistName = '/' + getIOSProjectname(project_dir) + '-Info.plist';

For more details about the fix please see https://github.com/apache/cordova-common/issues/88#issuecomment-531129778

IMPORTANT: it must be done before restoring/adding platforms and plugins or remove and restore platforms/plugins after this change is made.

sahyun1 commented 3 years ago

The file @ryaa refers to seems to changed a bit, there's no matching line nor variable names.

What I did was in xCode, open info tab and add FacebookAppID : id FacebookDisplayName : app package name

also on the bottom, add url type with fb*****(your id) image