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 909 forks source link

iOS build failed #753

Closed r-julien closed 4 years ago

r-julien commented 4 years ago

🐛 Bug Report

Hello, I'm facing some issues trying to install react-native-fbsdk for iOS.

When I try to build the project npx react-native run-ios I get a build failed and the following error

... "_swift_release", referenced from: (extension in FBSDKLoginKit):C.FBSDKLoginManager.logIn(permissions: [FBSDKCoreKit.Permission], viewController: C.UIViewController?, completion: (FBSDKLoginKit.LoginResult) -> ()?) -> () in libFBSDKLoginKit.a(LoginManager.o) (extension in FBSDKLoginKit):C.FBSDKLoginManager.(sdkCompletion in _C218275A97333B874EDDFE627110566C)((FBSDKLoginKit.LoginResult) -> ()?) -> (__C.FBSDKLoginManagerLoginResult?, Swift.Error?) -> ()? in libFBSDKLoginKit.a(LoginManager.o) reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed C.FBSDKLoginManagerLoginResult?, @guaranteed Swift.Error?) -> () to @escaping @callee_unowned @convention(block) (@unowned C.FBSDKLoginManagerLoginResult?, @unowned C.NSError?) -> () in libFBSDKLoginKit.a(LoginManager.o) _block_destroy_helper in libFBSDKLoginKit.a(LoginManager.o) closure #1 (C.FBSDKLoginManagerLoginResult?, Swift.Error?) -> () in (extension in FBSDKLoginKit):C.FBSDKLoginManager.(sdkCompletion in _C218275A97333B874EDDFE627110566C)((FBSDKLoginKit.LoginResult) -> ()?) -> (C.FBSDKLoginManagerLoginResult?, Swift.Error?) -> ()? in libFBSDKLoginKit.a(LoginManager.o) lobjectdestroy in libFBSDKLoginKit.a(LoginManager.o) swift_destroy_boxed_opaque_existential_0 in libFBSDKLoginKit.a(LoginManager.o) ... "_swift_retain", referenced from: (extension in FBSDKLoginKit):C.FBSDKLoginManager.(sdkCompletion in _C218275A97333B874EDDFE627110566C)((FBSDKLoginKit.LoginResult) -> ()?) -> (__C.FBSDKLoginManagerLoginResult?, Swift.Error?) -> ()? in libFBSDKLoginKit.a(LoginManager.o) reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed C.FBSDKLoginManagerLoginResult?, @guaranteed Swift.Error?) -> () to @escaping @callee_unowned @convention(block) (@unowned C.FBSDKLoginManagerLoginResult?, @unowned C.NSError?) -> () in libFBSDKLoginKit.a(LoginManager.o) _block_copy_helper in libFBSDKLoginKit.a(LoginManager.o) initializeBufferWithCopyOfBuffer value witness for FBSDKLoginKit.LoginResult in libFBSDKLoginKit.a(LoginManager.o) closure #1 (C.FBSDKLoginManagerLoginResult?, Swift.Error?) -> () in (extension in FBSDKLoginKit):C.FBSDKLoginManager.(sdkCompletion in _C218275A97333B874EDDFE627110566C)((FBSDKLoginKit.LoginResult) -> ()?) -> (__C.FBSDKLoginManagerLoginResult?, Swift.Error?) -> ()? in libFBSDKLoginKit.a(LoginManager.o) outlined copy of @escaping @callee_guaranteed (@guaranteed FBSDKLoginKit.LoginResult) -> ()? in libFBSDKLoginKit.a(LoginManager.o) generic specialization <serialized, (Swift.String, Any)> of static Swift.Array._allocateUninitialized(Swift.Int) -> ([A], Swift.UnsafeMutablePointer) in libFBSDKLoginKit.a(LoginManager.o) ... "_swift_unknownObjectRelease", referenced from: generic specialization <serialized, (Swift.String, Any)> of Swift.Array.getElement(: Swift.Int, wasNativeTypeChecked: Swift.Bool, matchingSubscriptCheck: Swift._DependenceToken) -> A in libFBSDKLoginKit.a(LoginManager.o) generic specialization <serialized, (Swift.String, Any)> of Swift._ArrayBuffer._getElementSlowPath(Swift.Int) -> Swift.AnyObject in libFBSDKLoginKit.a(LoginManager.o) "_swift_unknownObjectRetain", referenced from: generic specialization <serialized, (Swift.String, Any)> of Swift._ArrayBuffer._getElementSlowPath(Swift.Int) -> Swift.AnyObject in libFBSDKLoginKit.a(LoginManager.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.5.99. (in target 'BVLinearGradient' from project 'Pods') warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.5.99. (in target 'AppAuth' from project 'Pods') warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.5.99. (in target 'GTMSessionFetcher' from project 'Pods') warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 6.0, but the range of supported deployment target versions is 8.0 to 13.5.99. (in target 'RSKImageCropper' from project 'Pods') warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.5.99. (in target 'GTMAppAuth' from project 'Pods')

BUILD FAILED

The following build commands failed: Ld /Users/julien/Library/Developer/Xcode/DerivedData/pocketle-emfcnbkdszbootculljfplgswxvg/Build/Products/Debug-iphonesimulator/pocketle.app/pocketle normal x86_64 (1 failure)

To Reproduce

"react": "16.9.0",
"react-native": "0.61.5",
"react-native-fbsdk": "^2.0.0",

1- yarn add react-native-fbsdk 2- cd ios/ && pod install

3- Add the code in my AppDelegate.h

` /**

  • Copyright (c) Facebook, Inc. and its affiliates.
  • This source code is licensed under the MIT license found in the
  • LICENSE file in the root directory of this source tree. */

import "AppDelegate.h"

import <React/RCTBridge.h>

import <React/RCTBundleURLProvider.h>

import <React/RCTRootView.h>

import <FBSDKCoreKit/FBSDKCoreKit.h>

@implementation AppDelegate

  • (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions { [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];

    RCTBridge bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"pocketle" initialProperties:nil];

    rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; return YES; }

  • (NSURL )sourceURLForBridge:(RCTBridge )bridge {

    if DEBUG

    return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

    else

    return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

    endif

    }

  • (BOOL)application:(UIApplication )application openURL:(NSURL )url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {

    BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] annotation:options[UIApplicationOpenURLOptionsAnnotationKey] ]; // Add any custom logic here. return handled; }

@end

`

4- And run npx react-native run-ios

Expected Behavior

Build success

Is anyone facing the same issue and got some solution? Thanks for helping

n0f3 commented 4 years ago

I don't know if you saw, but this comment in another issue solves the problem: https://github.com/facebook/react-native-fbsdk/issues/755#issuecomment-634101710

r-julien commented 4 years ago

No, I didn't see this message. To solve this, I created a new project and copy-paste my code and everything is working now. So I didn't try to add a .swift file to my project to see if it solves the problem.

Thank you :)

kindacoder commented 4 years ago

you can downgrade to version ^1.1.2 and it should be good to go