jeduan / cordova-plugin-facebook4

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

FBSDKCoreKit/FBSDKCoreKit.h' file not found - with plugin v6.2.0, cordova-ios5.0.1 #811

Closed Zvika88 closed 4 years ago

Zvika88 commented 4 years ago

installed the plugin after a refresh of the pods (update, upgrade). Using the latest cordova-plugin-facebook4 v6.2.0 , cordova 9.0.1, on a Mac OS 10.14.6 .

During build in Xcode I get the error: FBSDKCoreKit/FBSDKCoreKit.h' file not found

The new doc for version 6.2.0 suggests that this is due to cordova-ios below 5, but mine is 5.0.1 . Adding the framework statements to plugin.xml does not help.

Any ideas?

peterpeterparker commented 4 years ago

Did you run pod update in your platforms/ios folder? Did try to update (sudo gem install cocoapods) Cocoapods? Did you try to remove and add the platform again?

vadimwe commented 4 years ago

Same problem for me. Any suggestions?

Zvika88 commented 4 years ago

@peterpeterparker: yes to all your questions. updated pods, removed and re-added ios platform - no effect.

important update: Applying the change that (per the docs) intends to address ion-cordova < 5, i.e:

 <framework src="FBSDKCoreKit" type="podspec" spec="5.7.0" />
 <framework src="FBSDKLoginKit" type="podspec" spec="5.7.0" />
 <framework src="FBSDKShareKit" type="podspec" spec="5.7.0" />

(doing this on a local disk copy of the plugin, then specifying that directory in package.json as source). It allows me to build the app in CL mode, i.e. "cordova build ios" or "cordova run ios" !

Again - I am on ios-cordova 5.0.1 and this helps! But in command line only.

However it does not help building in Xcode. Building in Xcode I still the error: FBSDKCoreKit/FBSDKCoreKit.h' file not found

guyeol commented 4 years ago

Same problem here.

Everything worked fine with v5.0.0 but after i updating to v6.2.0 caused the problem.

I already tried everything pod update sudo gem install cocoapods platform rm/add ios

Someone who solved this issue, please let me know!

vadimwe commented 4 years ago

Fix that solve problem for me.

  1. Platform iOS remove
  2. Platform iOS add@latest. It will install also fb plugin.
  3. Remove fb plugin
  4. Open pod file and manually add FBSDKCoreKit, FBSDKLoginKit, FBSDKShareKit
  5. pod install
  6. Install fb plugin. Don’t forget app id and app name variables
  7. Build iOS
Zvika88 commented 4 years ago

@vadimwe , how do you manually add the SDKs to the pod file(s)? I guess you are referring to the files called "Pod-xxxxxx.debug.xcconfig" and "Pod-xxxxxx.release.xcconfig" .

Here is my debug file - it already seem to have the FB kits defined. What am i missing? Or, is it somewhere else that needs to be changed?

Thanks, Z.

FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKLoginKit" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKShareKit" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/FBSDKShareKit/FBSDKShareKit.framework/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' OTHER_LDFLAGS = $(inherited) -l"z" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FBSDKShareKit" -weak_framework "Accounts" -weak_framework "AudioToolbox" -weak_framework "CoreGraphics" -weak_framework "CoreLocation" -weak_framework "Foundation" -weak_framework "QuartzCore" -weak_framework "Security" -weak_framework "Social" -weak_framework "UIKit" PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_ROOT = ${SRCROOT}/Pods USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES

peterpeterparker commented 4 years ago

@Zvika88 which version of cocoapods are u using (pod --version)? and Xcode version?

Zvika88 commented 4 years ago

hi @peterpeterparker , version 1.8.3 (freshly re-installed yesterday)

Zvika88 commented 4 years ago

@peterpeterparker and latest Xcode 11.0 (11A420A)

peterpeterparker commented 4 years ago

@Zvika88 thx for the info. same to me and no problems. not sure providing a sample repo would help but if you think so, I could check it out and give it a try on my machine?

When you do pod search FBSDKCoreKit --simple you do find v5.7.0 right?

Zvika88 commented 4 years ago

hmmm, it seems to finds 5.8.0...

` -> FBSDKCoreKit (5.8.0) Official Facebook SDK for iOS to access Facebook Platform core features pod 'FBSDKCoreKit', '~> 5.8.0'

`

peterpeterparker commented 4 years ago

@Zvika88 that's good, seems that cocoapods is definitely up-to-date then. according your spec you should be able to use the plugin referencing the pod without touching the plugin.xml

I honestly don't have much more idea. like I said, if you wish you could provide a sample repo and I could give it try

Zvika88 commented 4 years ago

The pods are present in the project, under ./platforms/ios/Pods

, and yet the statement in FacebookConnectPlugin.h : `

import <FBSDKCoreKit/FBSDKCoreKit.h>

`

does not find them when xcode runs. 'FBSDKCoreKit/FBSDKCoreKit.h' file not found

I am sure its something silly about xcode setup with pods, yet it escapes me. @vadimwe above says he solved it by manually adding the sdks to the pods but I am not sure I understand what he means.

vadimwe commented 4 years ago

@Zvika88 It`s very simple.

When I installed the plugin I don't know why pods wasn't installed from the console. You should go to platforms/ios/, find file Podfile and manually add missed pods (screenshot). After saving file run pod install command in terminal (same folder!).

Of course, you should update pods before.

Снимок экрана 2019-10-10 в 10 36 21

One moment, I tested to build only with the new (modern) build system. Not sure about legacy, but I think it should work as well.

vadimwe commented 4 years ago

@Zvika88 Any luck?

Zvika88 commented 4 years ago

@vadimwe, thanks. Not yet but it points to the likely problem - the path gets screwed up.

My podfile is fine (almost the same, it also has a "use_frameworks!" statement and specific ref to version 5.7.0). But when running "pod install" I get a warning: `

[!] The xxxxxxx [Debug] target overrides the LD_RUNPATH_SEARCH_PATHS build setting defined in 'Pods/Target Support Files/Pods-xxxxxxx/Pods-xxxxxxx.debug.xcconfig'. This can lead to problems with the CocoaPods installation

[!] The xxxxxxx [Release] target overrides the LD_RUNPATH_SEARCH_PATHS build setting defined in 'Pods/Target Support Files/Pods-xxxxxxx/Pods-xxxxxxx.release.xcconfig'. This can lead to problems with the CocoaPods installation

Here is my podfile:

source 'https://github.com/CocoaPods/Specs.git' platform :ios, '9.0' use_frameworks! target 'xxxxxxx' do project 'xxxxxxx.xcodeproj' pod 'FBSDKCoreKit', '5.7.0' pod 'FBSDKLoginKit', '5.7.0' pod 'FBSDKShareKit', '5.7.0' end

Zvika88 commented 4 years ago

solved - use ".xcworkspace" file (after pod install) in Xcode, not ".xcodeproj" .

Well, I've always been opening the xcodeproj file in Xcode - the file generated by cordova platform command - in order to do builds, archives and installs. (I also did not get to use pods before switching to this version of the facebook plugin that relies on pods) .

The error I reported: "'FBSDKCoreKit/FBSDKCoreKit.h' file not found" - occurs only when opening the xcodeproj file. It does not happen if using the xcworkspace file. I guess the xcworkspace file is a wrapper that sets up env variables for the pods in the project.

Since 3~4 other people above encountered the same issue within 24 hours from my report, there are probably more users like us who did not have cocoapods dependencies in their project before. Just run "pod install" and use the xcworkspace file!

Zvika88 commented 4 years ago

closing this issue. Thanks much @peterpeterparker and @vadimwe .

peterpeterparker commented 4 years ago

@Zvika88 happy to hear it worked out and good to know, what would be the error msg in case the .xcodeproj would be used 👍

Bruplanet commented 4 years ago

I experienced this same issue and tried all the suggested solutions to no avail. Eventually I realised that permissions might be at the heart of it. I was running all my Phonegap / Cordova CLI commands as root (via sudo) because I originally installed Node and Phonegap as root. I uninstalled everything, then reinstalled it all but this time as my local user (which involved changing write access to a few files along the way). Once I had an environment in which I could run the Phonegap / Cordova CLI commands as my local user, everything worked cleanly.

corncobb commented 3 years ago

Opening ".xcworkspace" file (after pod install) in Xcode instead of ".xcodeproj" worked for me. Thanks!