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:
- FacebookAdvertiserIDCollectionEnabled
- FacebookAppID
- FacebookAutoLogAppEventsEnabled
- FacebookClientToken
- FacebookDisplayName
- LSApplicationQueriesSchemes (for Facebook-related URL schemes)
- NSUserTrackingUsageDescription
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?
I have downgraded my react-native-fbsdk-next and pod as well.
nasi qsales is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.