react-native-fbads: Build with Facbeook iOS SDK v12 fails with 'FBSDKCoreKit/FBSDKSettings.h' file not found

Bug Report

Before opening

  • Did you try the latest release?
  • Did you look for existing issues?

Ad Modules

Platforms

iOS

Versions

  • Android:
  • iOS: 15
  • react-native-fbads: 7.0.5
  • react-native:0.65.1

Current Behaviour

Until this morning our release builds ran smoothly but re-running the same build that worked this morning fails with the following error:

/Users/user/actions-runner/_work/user-mobile/user-mobile/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m:10:9: 'FBSDKCoreKit/FBSDKSettings.h' file not found

#import <FBSDKCoreKit/FBSDKSettings.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expected Behaviour The build to run smooth again.

Steps to Reproduce It happens on two different build servers independent of a branch to build.

Thanks so much for any idea what this could cause it all of a sudden.

About this issue

Commits related to this issue

Most upvoted comments

I solved this problem.

try install ‘react-native-fbsdk’

yarn add react-native-fbsdk

And if you see an error message “The SDK version in the ad request is no longer supported for new apps. Please upgrade to the latest version of the SDK”, edit sdk version in react-native-fbads/android/app/build.gradle

I made a PR for this. you can see at sdk version error fixed

I am reopening this since the issue resurfaces when upgrading to Facebook iOS SDK v12. My current environment is:

    OS: macOS 12.0.1
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 25.21 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v14.17.5/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v14.17.5/bin/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 23, 26, 27, 28, 29
      Build Tools: 23.0.1, 25.0.0, 26.0.3, 27.0.3, 28.0.1, 28.0.2, 28.0.3
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6308749
    Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_221 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.66.3 => 0.66.3
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

My Podfile contains the following line:

  # Facebook
  pod 'FBSDKCoreKit', '~> 12.1'

Anyone that got v12 to work with react-native-fbads?

Hi guys, After spending tons of time I was finally able to build and run the app. here is a patch file that I made:

diff --git a/node_modules/react-native-fbads/ReactNativeAdsFacebook.podspec b/node_modules/react-native-fbads/ReactNativeAdsFacebook.podspec
index 7ba2cee..56120ef 100644
--- a/node_modules/react-native-fbads/ReactNativeAdsFacebook.podspec
+++ b/node_modules/react-native-fbads/ReactNativeAdsFacebook.podspec
@@ -13,6 +13,9 @@ Pod::Spec.new do |s|
   s.platform      = :ios, '7.0'
   s.dependency      'React'
   s.dependency      'FBAudienceNetwork'
+  s.dependency      'FBSDKCoreKit'
+  s.dependency      'FBSDKCoreKit_Basics'
+  s.dependency      'FBSDKGamingServicesKit'
 
   s.source_files  = 'ios/**/*.{h,m}'
 end
\ No newline at end of file
diff --git a/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m b/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m
index 56bb991..ee49228 100644
--- a/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m
+++ b/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m
@@ -126,7 +126,7 @@ - (void)setBridge:(RCTBridge *)bridge
 
 RCT_EXPORT_METHOD(setAdvertiserIDCollectionEnabled:(BOOL)enabled)
 {
-    [FBSDKSettings setAdvertiserIDCollectionEnabled:enabled];
+//    [FBSDKSettings setAdvertiserIDCollectionEnabled:enabled];
 }
 
 

@beqramo do we have to use something like patch-package to add these changes?

Hi guys, After spending tons of time I was finally able to build and run the app. here is a patch file that I made:

diff --git a/node_modules/react-native-fbads/ReactNativeAdsFacebook.podspec b/node_modules/react-native-fbads/ReactNativeAdsFacebook.podspec
index 7ba2cee..56120ef 100644
--- a/node_modules/react-native-fbads/ReactNativeAdsFacebook.podspec
+++ b/node_modules/react-native-fbads/ReactNativeAdsFacebook.podspec
@@ -13,6 +13,9 @@ Pod::Spec.new do |s|
   s.platform      = :ios, '7.0'
   s.dependency      'React'
   s.dependency      'FBAudienceNetwork'
+  s.dependency      'FBSDKCoreKit'
+  s.dependency      'FBSDKCoreKit_Basics'
+  s.dependency      'FBSDKGamingServicesKit'
 
   s.source_files  = 'ios/**/*.{h,m}'
 end
\ No newline at end of file
diff --git a/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m b/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m
index 56bb991..ee49228 100644
--- a/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m
+++ b/node_modules/react-native-fbads/ios/ReactNativeAdsFacebook/EXAdSettingsManager.m
@@ -126,7 +126,7 @@ - (void)setBridge:(RCTBridge *)bridge
 
 RCT_EXPORT_METHOD(setAdvertiserIDCollectionEnabled:(BOOL)enabled)
 {
-    [FBSDKSettings setAdvertiserIDCollectionEnabled:enabled];
+//    [FBSDKSettings setAdvertiserIDCollectionEnabled:enabled];
 }
 
 

Has anyone found a solution on this ? I got the same problem