thebergamo / react-native-fbsdk-next

MIT License
662 stars 164 forks source link

Facebook SDK Integration Issue in React Native App for iOS 14+ #543

Open qsales2022 opened 1 month ago

qsales2022 commented 1 month ago

🐛 Bug Report

To Reproduce

Expected Behavior

Code Example

Environment

Facebook SDK Integration Issue in React Native App for iOS 14+

I'm experiencing an issue with Facebook SDK integration in my React Native app. The SDK is working correctly on Android and iOS versions below 14, but it's not functioning properly on iOS 14 and above. Here's what I've implemented so far:

AppDelegate.mm

#import <React/RCTBundleURLProvider.h>
#import <AuthenticationServices/AuthenticationServices.h>
#import <SafariServices/SafariServices.h>
#import <FBSDKCoreKit/FBSDKCoreKit-Swift.h>
#import <FBAEMKit/FBAEMKit-Swift.h>
#import <React/RCTLinkingManager.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>

// In didFinishLaunchingWithOptions:
[[FBSDKApplicationDelegate sharedInstance] application:application
                       didFinishLaunchingWithOptions:launchOptions];

if (@available(iOS 14, *)) {
  [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
    // Handle tracking authorization status if needed
  }];
}

return [super application:application didFinishLaunchingWithOptions:launchOptions];

// OpenURL method
- (BOOL)application:(UIApplication *)application
   openURL:(NSURL *)url
   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  [FBAEMReporter configureWithNetworker:nil appID:@"YOUR_APP_ID" reporter:nil];
  [FBAEMReporter enable];
  [FBAEMReporter handle:url];

  return [RCTLinkingManager application:application openURL:url options:options];
}

Podfile

pod 'FBSDKCoreKit', '~> 17.0.0'
pod 'FBSDKLoginKit', '~> 17.0.0'
pod 'FBSDKShareKit', '~> 17.0.0'

Info.plist

I've added the necessary Facebook-related keys and values to my Info.plist file, including:

React Native Package

I'm using react-native-fbsdk-next version 13.0.0 in my project.

Despite these implementations, the Facebook SDK is not working on iOS 14 and above. What could be the issue, and how can I resolve it?

ellowwwteam commented 3 weeks ago

Screenshot from 2024-08-20 10-22-58

Same issue here and how to resolve it? Any solution for this issue?

i-ked-ii commented 6 days ago

Facebook needs upgrade SDK version iOS more than v17.0.0, And I am waiting package update.

Screenshot 2567-09-10 at 09 30 52