Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module 'FBSDKCoreKit' not found #1102

Closed
dafong opened this issue Nov 8, 2019 · 55 comments
Closed

Module 'FBSDKCoreKit' not found #1102

dafong opened this issue Nov 8, 2019 · 55 comments

Comments

@dafong
Copy link

dafong commented Nov 8, 2019

Checklist

Environment

  • Xcode Version: 11.2
  • Cocoapods 1.8.4
  • Facebook SDK Version 5.10
  • Unity2017.4.33f1

Goals

build iOS Project Successful

Expected Results

no compile error

Actual Results

has compile error
" Module 'FBSDKCoreKit' not found "

Steps to Reproduce

export iOS Project from Unity and build

Code Samples & Details

notice the error from below code

#ifdef BUCK
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#else
@import FBSDKCoreKit;
#endif

the compile execute the else part then throw a error.

when replace all these code with

#import <FBSDKCoreKit/FBSDKCoreKit.h>

it work's perfect.

@dafong
Copy link
Author

dafong commented Nov 8, 2019

It seems add these code in version 5.9 and 5.10. if change back the version to 5.8. It's still ok

@katou-o
Copy link

katou-o commented Nov 8, 2019

The downgrade from version 5.10 to 5.8 worked for me. Thank you.

@armnotstrong

This comment has been minimized.

@joesus
Copy link
Contributor

joesus commented Nov 8, 2019

Is this issue unity specific? Are you able to reproduce this using FBSDKCoreKit v5.10.0 via Cocoapods in a sample project?

@joesus
Copy link
Contributor

joesus commented Nov 8, 2019

I ask because in a new sample project with a very simple Podfile that just includes:
pod 'FBSDKCoreKit'
I am able to import into a Swift file with:
import FBSDKCoreKit
and build without issue.

Have you tried cleaning and removing derived data? (probably not the solution but usually helps surface things)

@polmum
Copy link

polmum commented Nov 8, 2019

I ask because in a new sample project with a very simple Podfile that just includes:
pod 'FBSDKCoreKit'
I am able to import into a Swift file with:
import FBSDKCoreKit
and build without issue.

Have you tried cleaning and removing derived data? (probably not the solution but usually helps surface things)

Are you using use_frameworks! in your sample project? Without it, the import should fail.

Also, adding the modular_headers flag should fix the issue:
pod 'FBSDKCoreKit', :modular_headers => true

@nicolasform
Copy link

Same error with this config:

    Xcode Version: 11.2
    Cocoapods 1.6.1
    Facebook SDK Version 5.10
    Unity2019.2.11f1

I solved the problem by doing the following:

  1. Edit the file Podfile at the root of the xcode project
  2. Replace '~> 5.2' by '5.8.0' in all the Facebook pods
  3. Run 'pod install' from a terminal at the root of the project
  4. Build the project in xcode, it should work

Here is my full Podfile in case you need more details:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'

target 'Unity-iPhone' do
  pod 'Crashlytics', '3.13.1'
  pod 'Fabric', '1.10.1'
  pod 'FBSDKCoreKit', '5.8.0'
  pod 'FBSDKLoginKit', '5.8.0'
  pod 'FBSDKShareKit', '5.8.0'
  pod 'Firebase/Core', '6.1.0'
  pod 'Firebase/DynamicLinks', '6.1.0'
end

@joesus
Copy link
Contributor

joesus commented Nov 8, 2019

@nicolasform, using the modular_headers => true flag, I was able to compile your podfile in a sample project.

This is clearly not a good solution and I will revisit using @import syntax or alternately see if there is a way to do this at the Podspec level.

Apologies for the inconvenience. Going to close this for now as there is a plan to fix as well as the two workarounds:

  1. Using the modular_headers => true flag
  2. Rolling back to 5.8

Thanks a ton @polmum for saving me the valuable time of finding the modular headers fix. :D

@joesus joesus closed this as completed Nov 8, 2019
@joesus
Copy link
Contributor

joesus commented Nov 8, 2019

Pushed updated versions of the pods. Please try again without any workarounds. :D

@bobber205
Copy link

@joesus I don't see any new releases. Any advice on how to get the update "to take"?

@joesus
Copy link
Contributor

joesus commented Nov 8, 2019

@joesus I don't see any new releases. Any advice on how to get the update "to take"?

It is bad practice but I decided it made sense in this case to overwrite the pushed pods because they were mis-released and unusable. If you deintegrate your pods 'pod deintegrate' and reinstall 'pod install' you should get the current code.

I would also recommend the usual incantation of deleting derived data and cleaning the build folder.

@thiagosmagalhaes
Copy link

I ask because in a new sample project with a very simple Podfile that just includes:
pod 'FBSDKCoreKit'
I am able to import into a Swift file with:
import FBSDKCoreKit
and build without issue.
Have you tried cleaning and removing derived data? (probably not the solution but usually helps surface things)

Are you using use_frameworks! in your sample project? Without it, the import should fail.

Also, adding the modular_headers flag should fix the issue:
pod 'FBSDKCoreKit', :modular_headers => true

Thanks, that solved my problem after a lot of brainstorming trying to solve

@floriangbh
Copy link

Hello,

I think I have the same issue with v5.10.0. I'm trying to migrate my pods to SPM, but I have this error after migrate FBSDK to SPM :
Screenshot 2019-11-10 at 15 01 31

Some of my pods aren't SPM compliant so I can't remove Cocoapods at this moment.

@joesus
Copy link
Contributor

joesus commented Nov 10, 2019

@floriangbh, thanks for bringing this up! I am kicking myself! 😣Fix pushed to #1106. Feel free to point your package to that branch and let me know if it works. Hoping to get this into the first patch release sometime in the near future!

@floriangbh
Copy link

@joesus thanks for the quick-fix ! It seem to be ok when I targeting the cocoapods-preprocessor-fix branch. Thanks !

@tgensol
Copy link

tgensol commented Nov 12, 2019

On my side the branch didn't change anything, I was still unable to compile, but :modular_headers => true fixed it

@nilsk123
Copy link

On my side the branch didn't change anything, I was still unable to compile, but :modular_headers => true fixed it

same here, this is not fixed yet

@raulrom13
Copy link

Same here, with version 5.10.1 this is not fixed yet.

@stkman
Copy link

stkman commented Nov 14, 2019

really stupid...

@regevbr
Copy link

regevbr commented Nov 14, 2019

5.8.0 doesn't work for me...

@cosgunhalil
Copy link

Open Xcode and add -fcxx-modules to Build Settings->Other C++ Flags->Debug and Release fields.
https://stackoverflow.com/questions/58853168/xcode-11-2-111b53-import-fbsdkcorekit-error

@adamlucktastic
Copy link

adamlucktastic commented Nov 14, 2019

Yes as stated above, the facebook-unity-sdk-7.17.2 worked when it pointed to version 5.8.
5.10 no longer works
You can just update your Dependencies.xml file
<?xml version="1.0" encoding="utf-8"?> <dependencies> <androidPackages> <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" /> <androidPackage spec="com.facebook.android:facebook-core:[5,6)" /> <androidPackage spec="com.facebook.android:facebook-applinks:[5,6)" /> <androidPackage spec="com.facebook.android:facebook-login:[5,6)" /> <androidPackage spec="com.facebook.android:facebook-share:[5,6)" /> </androidPackages> <iosPods> <iosPod name="Bolts" version="~> 1.7" /> <iosPod name="FBSDKCoreKit" version="5.8" /> <iosPod name="FBSDKLoginKit" version="5.8" /> <iosPod name="FBSDKShareKit" version="5.8" /> </iosPods> </dependencies>

@umairh2018
Copy link

Yes as stated above, the facebook-unity-sdk-7.17.2 worked when it pointed to version 5.8.
5.10 no longer works
You can just update your Dependencies.xml file
<?xml version="1.0" encoding="utf-8"?> <dependencies> <androidPackages> <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" /> <androidPackage spec="com.facebook.android:facebook-core:[5,6)" /> <androidPackage spec="com.facebook.android:facebook-applinks:[5,6)" /> <androidPackage spec="com.facebook.android:facebook-login:[5,6)" /> <androidPackage spec="com.facebook.android:facebook-share:[5,6)" /> </androidPackages> <iosPods> <iosPod name="Bolts" version="~> 1.7" /> <iosPod name="FBSDKCoreKit" version="5.8" /> <iosPod name="FBSDKLoginKit" version="5.8" /> <iosPod name="FBSDKShareKit" version="5.8" /> </iosPods> </dependencies>

Its a stupid question but i really don't know where do i update 5.8 inplace of 5.10.
& how to & where to add
pod 'FBSDKCoreKit', :modular_headers => true

@joesus
Copy link
Contributor

joesus commented Nov 18, 2019

Should be fixed for Unity projects with: #1122

@umairh2018
Copy link

umairh2018 commented Nov 18, 2019 via email

@jeffposey
Copy link

Yep, we are still stuck.

pod 'FBSDKCoreKit', :modular_headers => true

Does not seem to change anything. We need more information.

I changed all 10 files to #import instead of @import, and then it was all reverted the next build I made.

@jeffposey
Copy link

Ok, thanks. I believe this was installed from the Unity package 'facebook-unity-sdk-7.18.0' so I will try 'facebook-unity-sdk-7.17.2' which sounds like it uses 5.8?

@adamlucktastic
Copy link

adamlucktastic commented Nov 27, 2019 via email

@amirkhavari99
Copy link

After I update from ~> 5.2 to 5.8.0 the CoreKit problem disappears buy now ShareKit is not found, Could you please release a new Facebook SDK for Unity if you have solved it in iOS? None of the Unity SDK versions build on iOS and I really don't know what should we do, we are stuck here.

@riazhazan
Copy link

Same error with this config:

    Xcode Version: 11.2
    Cocoapods 1.6.1
    Facebook SDK Version 5.10
    Unity2019.2.11f1

I solved the problem by doing the following:

  1. Edit the file Podfile at the root of the xcode project
  2. Replace '~> 5.2' by '5.8.0' in all the Facebook pods
  3. Run 'pod install' from a terminal at the root of the project
  4. Build the project in xcode, it should work

Here is my full Podfile in case you need more details:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'

target 'Unity-iPhone' do
  pod 'Crashlytics', '3.13.1'
  pod 'Fabric', '1.10.1'
  pod 'FBSDKCoreKit', '5.8.0'
  pod 'FBSDKLoginKit', '5.8.0'
  pod 'FBSDKShareKit', '5.8.0'
  pod 'Firebase/Core', '6.1.0'
  pod 'Firebase/DynamicLinks', '6.1.0'
end

This solved my issue.

@adamlucktastic
Copy link

adamlucktastic commented Jan 9, 2020 via email

@iojason
Copy link

iojason commented Jan 10, 2020

@adamlucktastic - I tried '5.8'; still set to 5.8.0 with the same error. So far, I've tried downgrading the version to 5.8, use modular headers, add missing framework search path, and manually add the framework but no luck - Nothing works. The weird thing is building succeeds and I'm able to login successfully via Facebook on the iOS emulator. I just can't archive it to publish the app.

@umairh2018
Copy link

umairh2018 commented Jan 10, 2020 via email

@ZebingZong
Copy link

For anyone that this issue still happens, can you guys try to add use_frameworks! after platform :ios, '9.0' as a new line to see whether it fixes the issue? Here is an example Podfile

platform :ios, '9.0'

use_frameworks!

target 'ASRIOS' do

  # Pods for ASRIOS
  pod 'FBSDKCoreKit', '5.11.1'
  pod 'FBSDKLoginKit', '5.11.1'
  pod 'FBSDKShareKit', '5.11.1'

  target 'ASRIOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'ASRIOSUITests' do
    # Pods for testing
  end

end

@iojason
Copy link

iojason commented Jan 10, 2020

@ZebingZong I tried setting use_frameworks! right after platform declaration as well but no luck. I even tested it with use_modular_headers! but still can't archive the iOS app. I created a new Flutter app and able to archive it with no problem. There's something funky going on with FB SDK. It's never good to have too many dependencies/pods - I'm considering an alternative login method.

@iojason
Copy link

iojason commented Jan 10, 2020

@umairh2018 Thanks for the help. I'm actually using FBSDK on Flutter iOS. Tested most of the solutions proposed on the web and still unable to archive it. Possibly building an alternative by end of the week.

@ZebingZong
Copy link

ZebingZong commented Jan 10, 2020

@jasondphan sorry for the unpleasure experience but we are actively working on the fix. Because it is holidays seasons, so the response is slower than usual. Have you tried with some early versions of FBSDK (e.g., 5.5.0) to unblock yourself? And please make sure you delete 1) Podfile.lock 2) Pods folder 3) yourprojectname.xcworkspace. And also clean the build for xcode before you try to build new project with new podfile.

@iojason
Copy link

iojason commented Jan 10, 2020

@ZebingZong Thank you for working on a fix for this critical error. Yes, I've been carefully cleaning and deleting the needed files/folders before each podfile run. Just tested it with 5.5.0 and can't archive. After commenting out import FBSDKCoreKit in the AppDelegate.swift to see where it takes me, I'm now getting errors in the GeneratedPluginRegistrant.m file stating some of the @import modules are missing. Not sure if this is related or another Swift/Obj-C issue.

` - FBSDKCoreKit (5.5.0):
- FBSDKCoreKit/Basics (= 5.5.0)
- FBSDKCoreKit/Core (= 5.5.0)

  • FBSDKCoreKit/Basics (5.5.0)
  • FBSDKCoreKit/Core (5.5.0):
    • FBSDKCoreKit/Basics
  • FBSDKLoginKit (5.5.0):
    • FBSDKCoreKit (~> 5.0)`

@ZebingZong
Copy link

ZebingZong commented Jan 10, 2020

Hmm, it is very interesting. Can you please share the podfile for your project? Also which interface that you are using for FBSDK (Objective-C / Swift / Unity)?

@iojason
Copy link

iojason commented Jan 10, 2020

The interface is compiled to Objective-C from Flutter and using flutter_facebook_login package.

Podfile below:
`// Uncomment this line to define a global platform for your project
platform :ios, '11.0'

// CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
generated_key_values = {}
skip_line_start_symbols = ["//", "/"]
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*//{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("//{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: //{line}"
end
end
generated_key_values
end

target 'Runner' do
use_frameworks!
use_modular_headers!

// Flutter Pod

copied_flutter_dir = File.join(dir, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
// Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
// That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
// CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.

generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
  raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];

unless File.exist?(copied_framework_path)
  FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
  FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end

end

// Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'

// Plugin Pods

// Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
// referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
end
end

// Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end

// To resolve FirebaseCore missing headers when building for iOS
system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")
end

pod 'Firebase/Analytics'
pod 'Firebase/AdMob'

// pod 'FBSDKCoreKit' // didn't work
// pod 'FBSDKCoreKit', :modular_headers => true // didn't work
// pod 'FBSDKCoreKit', '5.8', :modular_headers => true

// Didn't work
//pod 'FBSDKCoreKit', '5.8'
//pod 'FBSDKLoginKit', '5.8'

// Didn't work
//pod 'FBSDKCoreKit', '5.8', :modular_headers => true
//pod 'FBSDKLoginKit', '5.8'

// pod 'FBSDKCoreKit', '~> 5.8', :modular_headers => true // didn't work
pod 'FBSDKCoreKit', '5.5.0'
pod 'FBSDKLoginKit', '5.5.0'`

@ZebingZong
Copy link

So to make sure I understand your issue, you are actually being able to compile and build the project with FBSDK but only encounter the issue when you are trying to archive it. If this is correct, I think your issue is not directly related to this one. I would suggest you to open another issue and give detailed explanation there to avoid the confusion. Thanks for your cooperation!

@iojason
Copy link

iojason commented Jan 10, 2020

So to make sure I understand your issue, you are actually being able to compile and build the project with FBSDK but only encounter the issue when you are trying to archive it. If this is correct, I think your issue is not directly related to this one. I would suggest you to open another issue and give detailed explanation there to avoid the confusion. Thanks for your cooperation!

Correct, "Module 'FBSDKCoreKit' not found" when trying to archive to publish the app. I'll create a separate issue if I can't solve this by end of Sunday or use a different login method. Thanks for your time @ZebingZong

@adamlucktastic
Copy link

adamlucktastic commented Jan 10, 2020 via email

@developer239
Copy link

How is this closed? 😂

@developer239
Copy link

developer239 commented Jan 16, 2020

Also rolling back to 5.8 is not a solution. 🙂

@iojason
Copy link

iojason commented Jan 16, 2020

Are you having archiving or distributing to the store. Can you provide some of the errors you’re seeing ?

On Jan 10, 2020, at 12:02 AM, umairh2018 @.> wrote: Have you install pod for unity build Xcode project. It helped me fix the issue. Write cd & drag Unity-iphone.xcodeproj in terminal & press enter then write pod install in terminal. it will install pod file & xcworkspace file in your Xcode project. open that file & build the Xcode project from Xcode. I hope it helps. On Fri, Jan 10, 2020 at 7:44 AM Jason Phan @.> wrote: > @adamlucktastic https://github.com/adamlucktastic - I tried '5.8'; > still set to 5.8.0 with the same error. So far, I've tried downgrading the > version to 5.8, use modular headers, add missing framework search path, and > manually add the framework but no luck - Nothing works. The weird thing is > building succeeds and I'm able to login successfully via Facebook on the > iOS emulator. I just can't archive it to publish the app. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <#1102?email_source=notifications&email_token=ALX3CE5FO3SAFFKMCO642ATQ47OKJA5CNFSM4JKW2PE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEISPTBA#issuecomment-572848516>, > or unsubscribe > https://github.com/notifications/unsubscribe-auth/ALX3CE2M7KJFDN3WTYLCGB3Q47OKJANCNFSM4JKW2PEQ > . > — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

@adamlucktastic - Archiving to release to the App store. It's working perfectly on the emulator. The only error I was seeing was "Module 'FBSDKCoreKit' not found". I even tried writing a custom header but it wouldn't take it. Tried Swift 4.2 and 5 too. In the end, I opted for a better login method for my target audience. Thanks for jumping in.

@developer239 - word.

@mtfum
Copy link

mtfum commented Jan 18, 2020

Changing pod 'FBSDKCoreKit' to pod 'FacebookCore' solved in my case!

#1132 (comment)

@joesus
Copy link
Contributor

joesus commented Jan 18, 2020

Changing pod 'FBSDKCoreKit' to pod 'FacebookCore' solved in my case!

#1132 (comment)

Please do not do or advise doing this.
These are different pods. ‘FacebookCore’ will pull down the deprecated Facebook Swift SDK. You absolutely DO NOT want to use this pod. It will not have critical bug fixes.

Happy to help diagnose the issue with using the latest version of the FBSDKCoreKit pod.

Also, just so we can improve the documentation. How did you decide to use ‘pod FacebookCore’? Did you read this somewhere?

@mtfum
Copy link

mtfum commented Jan 18, 2020

@joesus
Thanks for your advice.
At first, I read Facebook Analytics Quickstart Guide for iOS
So I didn't notice that.

@joesus
Copy link
Contributor

joesus commented Jan 18, 2020

@joesus
Thanks for your advice.
At first, I read Facebook Analytics Quickstart Guide for iOS
So I didn't notice that.

Good to know! I’ll make sure we get that updated to avoid future confusion!

@umairh2018
Copy link

umairh2018 commented Jan 20, 2020 via email

@umairh2018
Copy link

I am using the facebook audience network in Unity for advertisement. I am currently facing an issue while showing facebook banner ads in unity. Just when i call banner ad show call. Exception triggers:

java.lang.illegalargumentexception: adsize at com.facebook.ads.redexgen.x.8h.(:18251)

Anybody knows how can I resolve this issue? Thanks in advance

@joesus
Copy link
Contributor

joesus commented Jan 22, 2020

@umairh2018 please open a new issue with steps to reproduce.

@joesus
Copy link
Contributor

joesus commented Jan 22, 2020

The openers issue has been resolved. Comments on this issue are not longer helpful. Locking it.

@facebook facebook locked as off-topic and limited conversation to collaborators Jan 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests