facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 908 forks source link

Failed to build on latest version of react native #667

Closed zhigang1992 closed 4 years ago

zhigang1992 commented 4 years ago

🐛 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
darkredz commented 4 years ago

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

Dmitrylolo commented 4 years ago

same trouble after reinstall modules and pods.

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)
Dmitrylolo commented 4 years ago

Found temporary solution: replaced all

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

with #import <FBSDKCoreKit/FBSDKCoreKit.h>

Doko-Demo-Doa commented 4 years ago

Found temporary solution: replaced all

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

with #import <FBSDKCoreKit/FBSDKCoreKit.h>

May I ask where?

Dmitrylolo commented 4 years ago

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

Doko-Demo-Doa commented 4 years ago

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' => 'dzhuowen@fb.com' }
  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
mronline commented 4 years ago

+1

chgsilva commented 4 years ago

+1

janicduplessis commented 4 years ago

Fixed in 1.1.1

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

kyungtai-nam commented 4 years ago

please update unity SDK too

mikehardy commented 4 years ago

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

waheedakhtar694 commented 4 years ago

@mikehardy I am facing this, Is this due to some outdated pod dependency?

Screenshot 2019-12-03 at 1 08 20 PM
mikehardy commented 4 years ago

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

waheedakhtar694 commented 4 years ago

@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

mikehardy commented 4 years ago

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.

waheedakhtar694 commented 4 years ago

thanks, I will open another fresh issue.

waheedakhtar694 commented 4 years ago

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

Expanded from macro 'API_UNAVAILABLE

batmaster commented 4 years ago

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"
omererbil commented 4 years ago

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

veedeo commented 4 years ago

Im on 1.1.1 and still have the problem

FadiAboMsalam commented 4 years ago

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

mikehardy commented 4 years ago

@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?

curiouscosmos commented 4 years ago

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

tomchify commented 4 years ago

Hi fellow tinkerers,

Unfortunately the steps above all failed for me. I managed to integrate react-native-fbsdk@1.1.2 into a react-native@0.61.5 app by doing the following after yarn add react-native-fbsdk@1.1.2

  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.