React-native-fbsdk: Failed to build on latest version of react native

Created on 8 Nov 2019  路  24Comments  路  Source: facebook/react-native-fbsdk

馃悰 Bug Report

ios/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/Internal/FBSDKDeviceLoginManagerResult+Internal.h:24:9: Module 'FBSDKCoreKit' not found

image

Tried on both xcode 11 and xcode 10, and legacy build mode

To Reproduce

https://github.com/zhigang1992/react-native-fbsdk-build-error

react-native init Awesome

and

yarn add react-native-fbsdk

and

pod install

Expected Behavior

Should be able to compile

Code Example

https://github.com/zhigang1992/react-native-fbsdk-build-error

Environment

info Fetching system and libraries information...
System:
    OS: macOS 10.15.1
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
    Memory: 2.23 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.16.3 - /var/folders/kp/tsl3bbtd3kz3qzqj_p_px7wr0000gn/T/fnm-shell-996543/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.9.0 - /var/folders/kp/tsl3bbtd3kz3qzqj_p_px7wr0000gn/T/fnm-shell-996543/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.4 => 0.61.4

Most helpful comment

Adding pod 'FBSDKCoreKit', '~> 5.8', :modular_headers => true to Pod file worked for me

All 24 comments

facing the same issue when trying to compile v1.0.4 with RN 0.61.4

same trouble after reinstall modules and pods.
Downloading dependencies Installing FBSDKCoreKit 5.10.0 (was 5.8.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`) Installing FBSDKLoginKit 5.10.0 (was 5.8.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`) Installing FBSDKShareKit 5.9.0 (was 5.8.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`) Installing react-native-fbsdk 1.1.0 (was 1.0.4)

Found temporary solution: replaced all

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

with
#import <FBSDKCoreKit/FBSDKCoreKit.h>

Found temporary solution: replaced all

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

with
#import <FBSDKCoreKit/FBSDKCoreKit.h>

May I ask where?

Found temporary solution: replaced all

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

with
#import <FBSDKCoreKit/FBSDKCoreKit.h>

May I ask where?

everywhere in fbsdk, i did it in about 23 files

Okay I found another solution. Gonna use it until Facebook fixes their lib:

Change the version prefix from ~> to =:

require 'json'
package = JSON.parse(File.read(File.join(__dir__, './', 'package.json')))

Pod::Spec.new do |s|
  s.name          = package['name']
  s.version       = package['version']
  s.summary       = package['description']
  s.requires_arc  = true
  s.author        = { 'dzhuowen' => '[email protected]' }
  s.license       = package['license']
  s.homepage      = package['homepage']
  s.source        = { :git => 'https://github.com/facebook/react-native-fbsdk.git', :tag => "v#{package['version']}" }
  s.platform      = :ios, '8.0'
  s.dependency      'React'

  s.subspec 'Core' do |ss|
    # ss.dependency     'FBSDKCoreKit', '~> 5.8'
    ss.dependency     'FBSDKCoreKit', '= 5.8'
    ss.source_files = 'ios/RCTFBSDK/core/*.{h,m}'
  end

  s.subspec 'Login' do |ss|
    # ss.dependency     'FBSDKLoginKit', '~> 5.8'
    ss.dependency     'FBSDKLoginKit', '= 5.8'
    ss.source_files = 'ios/RCTFBSDK/login/*.{h,m}'
  end

  s.subspec 'Share' do |ss|
    # ss.dependency     'FBSDKShareKit', '~> 5.8'
    ss.dependency     'FBSDKShareKit', '= 5.8'
    ss.source_files = 'ios/RCTFBSDK/share/*.{h,m}'
  end
end

+1

+1

Fixed in 1.1.1

Would be nice if we can figure out how to get it building with the latest sdk

please update unity SDK too

I saw the outdated pod in my dependency report this morning, so I came here, saw this, and just scanned through the related stuff.

Based on fix/release timing it seems like 5.11.1 of the underlying SDK should still have the problem, but it has been identified https://github.com/facebook/facebook-ios-sdk/issues/1105#issuecomment-555740990 and a fix has merged already https://github.com/facebook/facebook-ios-sdk/pull/1133

@janicduplessis The upstream fix merge happened after the last upstream release, so I think the action here is to wait for an upstream SDK release >= 5.11.2 at which point the podspec here can go back from '=' to '~>'. Based on previous release cadence upstream I'd be that's within the next 2 days give or take

Cheers

@mikehardy I am facing this, Is this due to some outdated pod dependency?
Screenshot 2019-12-03 at 1 08 20 PM

I don't know, I do know that pasting the actual text of build errors, within triple-backticks

like this

is a much better way to go about troubleshooting though. Not nearly enough context in a small image

@mikehardy Actually i have linked facebook sdk on react-native version 0.59.3 and after upgrading to 0.60.5 i am getting this error after installing the pod from and while build FBSDK i get this error.

Parse issue Expected ','
from OIDExternalUserAgentIOSCustomBrowser.h
I have added use_frameworks! in my pod file and i am currently on Xcode verison 10.3

Unfortunately I don't think that has anything to do with this issue. You'd probably be better opening a fresh issue following whatever template exists in this repository, so full details exist to troubleshoot.

thanks, I will open another fresh issue.

by the way i am also getting this error along with this

Expanded from macro 'API_UNAVAILABLE

I've tried to install FBSDKCoreKit by pod install. Then pod installed 5.12.0 and XCode show the same error. I fixed by changing Podfile at line
pod 'FBSDKCoreKit'
to
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
as Manually link the library on iOS in README.md, then pod update. The pod installed 5.8.0 instead and it work well right now.
```
"react": "16.8.6"
"react-native": "0.60.5"
"react-native-fbsdk": "1.1.1"
````

in podfile just change to this
pod 'FBSDKCoreKit', '5.8.0'
pod 'FBSDKLoginKit', '5.8.0'
pod 'FBSDKShareKit', '5.8.0'

Im on 1.1.1 and still have the problem

@appify-waheed i am facing same issue ! any solutions to this ?

@janicduplessis this is very strange to me, per my comment above I was sure that upstream Pods >= 5.12 would fix it, as they had merged a fix, but with Pods 5.14.0 (current as of this typing) the build still breaks :thinking:

That means the expected fix was not the fix and I suppose there is still a problem here?

Adding pod 'FBSDKCoreKit', '~> 5.8', :modular_headers => true to Pod file worked for me

Hi fellow tinkerers,

Unfortunately the steps above all failed for me. I managed to integrate [email protected] into a [email protected] app by doing the following after yarn add [email protected]

  1. Modifying inside xcode Pods/Development Pods/react-native-fbsdk/Pod/react-native-fbsdk.podspec with:
s.subspec 'Core' do |ss|
    ss.dependency     'FBSDKCoreKit', '~> 4.38.0'
    ss.source_files = 'ios/RCTFBSDK/core/*.{h,m}'
  end

  s.subspec 'Login' do |ss|
    ss.dependency     'FBSDKLoginKit', '~> 4.38.0'
    ss.source_files = 'ios/RCTFBSDK/login/*.{h,m}'
  end

  s.subspec 'Share' do |ss|
    ss.dependency     'FBSDKShareKit', '~> 4.38.0'
    ss.source_files = 'ios/RCTFBSDK/share/*.{h,m}'
  end
  1. In /ios delete Podfile.lock, and add to Podfile:
  pod 'FBSDKCoreKit', '~> 4.38.0'
  pod 'FBSDKLoginKit', '~> 4.38.0'
  1. pod install
  2. run the app - get lots of errors. Comment out everything that errors, except for inside RCTFBSDKLoginManager.m, where you change logInWithPermissions back to the older logInWithReadPermissions version:
RCT_EXPORT_METHOD(logInWithPermissions:(NSArray<NSString *> *)permissions
                  resolver:(RCTPromiseResolveBlock)resolve
                  rejecter:(RCTPromiseRejectBlock)reject)
{
  [_loginManager logInWithReadPermissions:@[@"email"] fromViewController:nil handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    if (error) {
      reject(@"FacebookSDK", @"Login Failed", error);
    } else {
      resolve(RCTBuildResultDictionary(result));
    }
  }];
};

At this point, I ran on my device and was able to login to Facebook successfully. Hope this helps someone.

Was this page helpful?
0 / 5 - 0 ratings