facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.8k stars 3.56k forks source link

Xcode15.3: After updating SDKv17.0.0 through SPM, an error occurred while running the project: dyld [5199]: Library not loaded: @ rpath/FBSDKCoreKit. framework/FBSDKCoreKit, unable to start the application #2385

Closed dongxianbin closed 7 months ago

dongxianbin commented 7 months ago

Checklist before submitting a bug report

Xcode version

Version 15.3 (15E204a)

Facebook iOS SDK version

17.0.0

Dependency Manager

SPM

SDK Framework

Core

Goals

Update Facebook iOS SDK version 17.0.0 to adapt to Apple's development privacy list

Expected results

Running normally without any issues

Actual results

dyld[4568]: Library not loaded: @rpath/FBSDKCoreKit.framework/FBSDKCoreKit Referenced from: /private/var/containers/Bundle/Application/2822F927-C630-4091-A397-90F66483DFEF/FrogJumpGame-mobile.app/FrogJumpGame-mobile Reason: tried: '/usr/lib/swift/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/Users/mutong/Library/Developer/Xcode/DerivedData/FrogJumpGame-gwwoxmkgaezcejfczgbcxcfkukhv/Build/Products/Debug-iphoneos/PackageFrameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/private/preboot/Cryptexes/OS/Users/mutong/Library/Developer/Xcode/DerivedData/FrogJumpGame-gwwoxmkgaezcejfczgbcxcfkukhv/Build/Products/Debug-iphoneos/PackageFrameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/usr/lib/swift/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/Users/mutong/Library/Developer/Xcode/DerivedData/FrogJumpGame-gwwoxmkgaezcejfczgbcxcfkukhv/Build/Products/Debug-iphoneos/PackageFrameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/private/preboot/Cryptexes/OS/Users/mutong/Library/Developer/Xcode/DerivedData/FrogJumpGame-gwwoxmkgaezcejfczgbcxcfkukhv/Build/Products/Debug-iphoneos/PackageFrameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file)

Steps to reproduce

Import SDKv17.0.0 through SPM and run Xcode

Code samples & details

No response

zhoubo6419 commented 7 months ago

I encountered the same problem

Xcode version Version 15.1 (15C65)

Facebook iOS SDK version 17.0.0

Dependency Manager Pod

SDK Framework Core

Goals Update Facebook iOS SDK version 17.0.0 to adapt to Apple's development privacy list

Expected results Running normally without any issues

Actual results dyld[2331]: Library not loaded: @rpath/FBSDKCoreKit.framework/FBSDKCoreKit Referenced from: /private/var/containers/Bundle/Application/A2B88D97-5F62-4611-B82A-E545864CFB06/xxx.app/xxx Reason: tried: '/usr/lib/swift/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/private/var/containers/Bundle/Application/A2B88D97-5F62-4611-B82A-E545864CFB06/xxx.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/private/var/containers/Bundle/Application/A2B88D97-5F62-4611-B82A-E545864CFB06/xxx.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/usr/lib/swift/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/private/var/containers/Bundle/Application/A2B88D97-5F62-4611-B82A-E545864CFB06/xxx.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/private/var/containers/Bundle/Application/A2B88D97-5F62-4611-B82A-E545864CFB06/xxx.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), '/System/Library/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file)

Steps to reproduce Import SDKv17.0.0 through Pod and run Xcode

Code samples & details No response

zhoubo6419 commented 7 months ago
截屏2024-04-17 16 18 45

I can solve it this way but I'm worried there will be some problems

dongxianbin commented 7 months ago

Build Settings -> Runpath Search Paths: @executable_path/Frameworks

vahancouver commented 7 months ago

Build Settings -> Runpath Search Paths: @executable_path/Frameworks

@dongxianbin Can you please explain? I have my Runpath Search Paths: @executable_path/Frameworks and still getting the same error

dongxianbin commented 7 months ago

Build Settings -> Runpath Search Paths: @executable_path/Frameworks

@dongxianbin Can you please explain? I have my Runpath Search Paths: @executable_path/Frameworks and still getting the same error

I compared my project with another functioning one and realized that my project was lacking an essential element - Build Settings -> Runpath Search Paths: @executable_path/Frameworks. Upon making this necessary modification, my project started running smoothly.

zhoubo6419 commented 7 months ago

I have my Runpath Search Paths: @executable_path/Frameworks and still getting the same error

vahancouver commented 7 months ago

I have my Runpath Search Paths: @executable_path/Frameworks and still getting the same error

Same for me!

Also worth mentioning that this issue happens while running on a device only (works fine on a simulator)

PS. I'm using SPM

dongxianbin commented 7 months ago

I don't have any other way. I created a new app using Xcode, imported FBSDKv17.0.0, and then ran it normally. Then, I compared the new Xcode project with my own Xcode project and found a solution. You can also try it out.

zhoubo6419 commented 7 months ago

I'm using pod same problem

截屏2024-04-18 09 47 32
FabianBartels commented 7 months ago

The same happened to me:

It works fine for the simulator but crashes for the real device.

dyld[9576]: Library not loaded: @rpath/FBSDKCoreKit.framework/FBSDKCoreKit Referenced from: <6D021832-8211-3954-9421-9B21CE49BB9C> /private/var/containers/Bundle/Application/2CAC9516-6C7B-4460-B4E6-2590A3195984/XXX.app/XXX Reason: tried: '/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-hevagtfawervsfccdbpjpkfiqeqp/Build/Products/Debug-iphoneos/PackageFrameworks/FBSDKCoreKit.framework/FBSDKCoreKit' (no such file), ...

Not sure but as i checked my folder structure i detected that the folder .../PackageFrameworks/.. in path /Users/XXX/Library/Developer/Xcode/DerivedData/XXX-hevagtfawervsfccdbpjpkfiqeqp/Build/Products/Debug-iphoneos/PackageFrameworks/FBSDKCoreKit.framework does not even exists so it cant find FBSDKCoreKit.framework there.

However, when navigating to the directory to the parent dir of PackageFrameworks (/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-hevagtfawervsfccdbpjpkfiqeqp/Build/Products/Debug-iphoneos/FBSDKCoreKit.framework) i can find the FBSDKCoreKit.framework.

So far i think i need to find a way to change the dir somehow :).

Letting you know if this is not an dead end.

vahancouver commented 7 months ago

In my case I'm adding the FB SDK via SPM in a framework as a dependency, than using that framework in a an app. That's when i'm getting this error.

But when I create a brand new app and directly add FB SDK via SPM, I see no issues.

This means something is different when the FB SDK is added to a framework target. @dongxianbin is this helpful at all? any chance you can test this on your side?

Thanks.

PS. This is a new issue in 17.0.0. It works with no issues on 16.1.0

dongxianbin commented 7 months ago

@vahancouver ,My original Xcode project was created through Cocos, so there may be some differences in Build Setting compared to normal Xcode projects. I compared the methods you mentioned and found a solution. This issue did not occur before version 17.0.0. Different Xcode projects may have different problems, so it is recommended that if the same problem occurs, you create a new app using Xcode, import FBSDK according to your own method, and then compare the differences between the two projects before, step by step, to modify and test. There is no other good way.

VikasTTN commented 7 months ago

I'm also encountering the same problem. After updating SPM to version 17.0.0, the app crashes during launch on iOS 13.

aleufms commented 7 months ago

I'm having the same issue. It's because we do not import the facebook lib directly in our project, but through an module: our app -> libs module (have all the libs through spm) -> facebook sdk.

VikasTTN commented 7 months ago

@aleufms any solution for this ?

aleufms commented 7 months ago

@VikasTTN no :(

aleufms commented 7 months ago

@VikasTTN I have workarounded this issue. I have imported the lib in the app too, and it is working on actual devices. Not ideal, but it an temporary solution.