Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading /var/containers/Bundle/Application/XXX/unity-framework.app/Frameworks/UnityFramework.framework/UnityFramework: dlopen(/var/containers/Bundle/Application/637025C2-0BDB-47ED-B2DE-FB4F05CE05A5/unity-framework.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/FBAEMKit.framework/FBAEMKit #2128

Open
5 tasks done
mayyang opened this issue Oct 10, 2022 · 21 comments

Comments

@mayyang
Copy link

mayyang commented Oct 10, 2022

Checklist before submitting a bug report

Xcode version

13.4.1

Facebook iOS SDK version

13.2.0

Dependency Manager

CocoaPods

SDK Framework

Login

Goals

Error loading /var/containers/Bundle/Application/637025C2-0BDB-47ED-B2DE-FB4F05CE05A5/unity-framework.app/Frameworks/UnityFramework.framework/UnityFramework: dlopen(/var/containers/Bundle/Application/637025C2-0BDB-47ED-B2DE-FB4F05CE05A5/unity-framework.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/FBAEMKit.framework/FBAEMKit
Referenced from: /private/var/containers/Bundle/Application/637025C2-0BDB-47ED-B2DE-FB4F05CE05A5/unity-framework.app/Frameworks/UnityFramework.framework/UnityFramework
Reason: tried: '/private/var/containers/Bundle/Application/637025C2-0BDB-47ED-B2DE-FB4F05CE05A5/unity-framework.app/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file),

Expected results

Actual results

app crashed
Error loading /var/containers/Bundle/Application/637025C2-0BDB-47ED-B2DE-FB4F05CE05A5/unity-framework.app/Frameworks/UnityFramework.framework/UnityFramework: dlopen(/var/containers/Bundle/Application/637025C2-0BDB-47ED-B2DE-FB4F05CE05A5/unity-framework.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/FBAEMKit.framework/FBAEMKit
Referenced from: /private/var/containers/Bundle/Application/637025C2-0BDB-47ED-B2DE-FB4F05CE05A5/unity-framework.app/Frameworks/UnityFramework.framework/UnityFramework
Reason: tried: '/private/var/containers/Bundle/Application/637025C2-0BDB-47ED-B2DE-FB4F05CE05A5/unity-framework.app/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file),

Steps to reproduce

Our game uses unity2019,write podfile as this:

target 'UnityFramework' do

inherit! :search_paths
pod 'FBSDKLoginKit', '13.2.0'

end

#target 'Unity-iPhone' do
#inherit! :search_paths

#pod 'OpenSSL-Universal', '1.1.1100'

#end

Code samples & details

pod 'FBSDKLoginKit', '13.2.0'
@mayyang
Copy link
Author

mayyang commented Oct 11, 2022

After pod install,I got the warning like this:

[!] The Podfile contains framework or static library targets (UnityFramework), for which the Podfile does not contain host targets (targets which embed the framework).
If this project is for doing framework development, you can ignore this message. Otherwise, add a target to the Podfile that embeds these frameworks to make this message go away (e.g. a test target).

but I have to use it like the podfile as above。

@isso-tat
Copy link

isso-tat commented Nov 7, 2022

After updating from FacebookUnitySDK 9.2.0 to 14.0.0 I got the same error.
(Unity 2020.3.32f1)

Managed to fix this by changing Podfile from:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

target 'UnityFramework' do
  use_frameworks! :linkage => :static
  pod 'FBSDKCoreKit', '~> 14.0'
  pod 'FBSDKCoreKit_Basics', '~> 14.0'
  pod 'FBSDKGamingServicesKit', '~> 14.0'
  pod 'FBSDKLoginKit', '~> 14.0'
  pod 'FBSDKShareKit', '~> 14.0'
end
target 'Unity-iPhone' do
end
use_frameworks!
use_frameworks!

to:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

target 'UnityFramework' do
  use_frameworks! # changed to dynamic linkage
  pod 'FBSDKCoreKit', '~> 14.0'
  pod 'FBSDKCoreKit_Basics', '~> 14.0'
  pod 'FBSDKGamingServicesKit', '~> 14.0'
  pod 'FBSDKLoginKit', '~> 14.0'
  pod 'FBSDKShareKit', '~> 14.0'
end
target 'Unity-iPhone' do
end
use_frameworks!
use_frameworks!

If anyone has any updates for this issue, would appreciate it if you can share.

@albert-pixel
Copy link

Removing ":linkage => :static" worked for me. Thanks!

@Phoder1
Copy link

Phoder1 commented Dec 15, 2022

After updating from FacebookUnitySDK 9.2.0 to 14.0.0 I got the same error. (Unity 2020.3.32f1)

Managed to fix this by changing Podfile from:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

target 'UnityFramework' do
  use_frameworks! :linkage => :static
  pod 'FBSDKCoreKit', '~> 14.0'
  pod 'FBSDKCoreKit_Basics', '~> 14.0'
  pod 'FBSDKGamingServicesKit', '~> 14.0'
  pod 'FBSDKLoginKit', '~> 14.0'
  pod 'FBSDKShareKit', '~> 14.0'
end
target 'Unity-iPhone' do
end
use_frameworks!
use_frameworks!

to:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

target 'UnityFramework' do
  use_frameworks! # changed to dynamic linkage
  pod 'FBSDKCoreKit', '~> 14.0'
  pod 'FBSDKCoreKit_Basics', '~> 14.0'
  pod 'FBSDKGamingServicesKit', '~> 14.0'
  pod 'FBSDKLoginKit', '~> 14.0'
  pod 'FBSDKShareKit', '~> 14.0'
end
target 'Unity-iPhone' do
end
use_frameworks!
use_frameworks!

If anyone has any updates for this issue, would appreciate it if you can share.

This worked for me thanks!

But my use_frameworks! line was at the end of the podfile and I had to move it to the same place as your example for it to work.

@firesightstudios
Copy link

same issue, however changing pod file has same crash at app load using FB version 16

@DmitrySharov
Copy link

Unity 2022.2.14f
Xcode - 1.14.1
Fb sdk 16.0.0
The problem is reproduced.
This greatly interferes with our production process.

@creutzfeldt0
Copy link

Unity 2021.3.23f1
Xcode 1.14.2
FB SDK 16.0.0
CocoaPod 1.12.1
M1 CPU Ventura 13.3.1
Xcode Setting UnityFramework - BuildSetting - Always Embed Swift Standard Libraries No.
Pods - BuildSetting - EnableBitcode Yes.
CocoaPod Setting use_frameworks! converted

Pod Install Success.
Xcode Archive Success.
TestFlight Play Test - Crash.

Same Issue.

@dalhwa-studio
Copy link

in unity2021.3.24,
the same trouble.
anyone help?

@NguyenTongTran
Copy link

Solution from @tatsuki5820iso seems work. I just want to add some more info, instead of manually editing Podfile, you guys can untick Link frameworks statically in iOS Resolver Setting (from EDM menu in Unity) which will do similar for every build

@Stranoshop
Copy link

Stranoshop commented May 30, 2023 via email

@liutiangang
Copy link

I am facing the same issue now. Have you managed to solve your problem? I am using version 16.1.0, and after adding the relevant xcframework to the "Frameworks, Libraries, and Embedded Content" entry, the test runs normally. However, the app crashes after uploading to TestFlight and opening it.

@thangvu207
Copy link

Solution from @tatsuki5820iso seems work. I just want to add some more info, instead of manually editing Podfile, you guys can untick Link frameworks statically in iOS Resolver Setting (from EDM menu in Unity) which will do similar for every build

This worked for me. Thanks!

@iantierney
Copy link

Hey,
when I remove the "Link frameworks statically" in the "External Dependency Manager".
Strangely, I get a linker error.

Here's a proposed solution to the linker error

I don't understand why linking dynamically would cause a linker error at build time.
Also this is all making my build process messy.
Can anyone explain what is actually going on?

@tbiz5270
Copy link

I encountered this problem after integrating the Facebook SDK, which didn't seem to play nicely with the AppLovin MAX SDK settings.

A mixture of the above solutions worked for me. I'll list the details below.

Unity Editor: 2021.3.25f1
AppLovin MAX Plugin (Unity): 5.11.2
AppLovin MAX Plugin (iOS): 11.11.2
Facebook SDK: 16.0.1
Xcode Version: 14.2

First, I changed my iOS Resolver settings to the following:

iosResolver

These settings are different from what AppLovin's integration instructions recommend, but it was the only way I managed to get things working.

My FacebookSDK > Plugins > Editor > Dependencies.xml file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
        <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" />
        <androidPackage spec="com.facebook.android:facebook-core:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-applinks:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-login:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-share:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-gamingservices:[16.0,17)" />
    </androidPackages>
    <iosPods>
        <iosPod name="FBSDKCoreKit_Basics" version="~> 16.0" />
        <iosPod name="FBSDKCoreKit" version="~> 16.0" />
        <iosPod name="FBSDKLoginKit" version="~> 16.0" />
        <iosPod name="FBSDKShareKit" version="~> 16.0" />
        <iosPod name="FBSDKGamingServicesKit" version="~> 16.0" />
    </iosPods>
</dependencies>

After building the project to iOS, it generates a Podfile looking like this:

source 'https://cdn.cocoapods.org/'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'AppLovinMediationAdColonyAdapter', '4.9.0.0.4'
  pod 'AppLovinMediationByteDanceAdapter', '5.4.0.7.0'
  pod 'AppLovinMediationChartboostAdapter', '9.4.0.0'
  pod 'AppLovinMediationFacebookAdapter', '6.14.0.0'
  pod 'AppLovinMediationGoogleAdapter', '10.9.0.1'
  pod 'AppLovinMediationIronSourceAdapter', '7.4.0.0.1'
  pod 'AppLovinMediationUnityAdsAdapter', '4.8.0.1'
  pod 'AppLovinMediationVungleAdapter', '7.0.1.0'
  pod 'AppLovinSDK', '11.11.2'
  pod 'FBAudienceNetwork', '~> 6.4.1'
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

However, I had to manually remove the pod 'FBAudienceNetwork', '~> 6.4.1' line to make Xcode happy. So my final Podfile looks like this:

source 'https://cdn.cocoapods.org/'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'AppLovinMediationAdColonyAdapter', '4.9.0.0.4'
  pod 'AppLovinMediationByteDanceAdapter', '5.4.0.7.0'
  pod 'AppLovinMediationChartboostAdapter', '9.4.0.0'
  pod 'AppLovinMediationFacebookAdapter', '6.14.0.0'
  pod 'AppLovinMediationGoogleAdapter', '10.9.0.1'
  pod 'AppLovinMediationIronSourceAdapter', '7.4.0.0.1'
  pod 'AppLovinMediationUnityAdsAdapter', '4.8.0.1'
  pod 'AppLovinMediationVungleAdapter', '7.0.1.0'
  pod 'AppLovinSDK', '11.11.2'
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

Changing: 'FBAudienceNetwork', '~> 6.4.1' to 'FBAudienceNetwork', '~> 6.14.0' to match the AppLovin Facebook Adaptor version also worked. Either way, these changes seem to correctly generate the required pod.

After making these changes to the Podfile, I run pod update to install the pods and generate the workspace file.

Open the workspace file (Unity-iPhone.xcworkspace), not the Xcode file (Unity-iPhone.xcodeproj) to open the project in Xcode.

Next, I had to manually drag and drop the Facebook SDK pod frameworks into the Unity-iPhone project:

dragPods

Finally, after all of these steps, I was able to compile the build and run it on my iOS device without crashing on start.

Hope this helps!

@yoambulante
Copy link

yes, this worked for me too, adding manually the FB* pods to the project

@TahaHassan672
Copy link

I encountered this problem after integrating the Facebook SDK, which didn't seem to play nicely with the AppLovin MAX SDK settings.

A mixture of the above solutions worked for me. I'll list the details below.

Unity Editor: 2021.3.25f1 AppLovin MAX Plugin (Unity): 5.11.2 AppLovin MAX Plugin (iOS): 11.11.2 Facebook SDK: 16.0.1 Xcode Version: 14.2

First, I changed my iOS Resolver settings to the following:

iosResolver These settings are different from what AppLovin's integration instructions recommend, but it was the only way I managed to get things working.

My FacebookSDK > Plugins > Editor > Dependencies.xml file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
        <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" />
        <androidPackage spec="com.facebook.android:facebook-core:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-applinks:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-login:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-share:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-gamingservices:[16.0,17)" />
    </androidPackages>
    <iosPods>
        <iosPod name="FBSDKCoreKit_Basics" version="~> 16.0" />
        <iosPod name="FBSDKCoreKit" version="~> 16.0" />
        <iosPod name="FBSDKLoginKit" version="~> 16.0" />
        <iosPod name="FBSDKShareKit" version="~> 16.0" />
        <iosPod name="FBSDKGamingServicesKit" version="~> 16.0" />
    </iosPods>
</dependencies>

After building the project to iOS, it generates a Podfile looking like this:

source 'https://cdn.cocoapods.org/'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'AppLovinMediationAdColonyAdapter', '4.9.0.0.4'
  pod 'AppLovinMediationByteDanceAdapter', '5.4.0.7.0'
  pod 'AppLovinMediationChartboostAdapter', '9.4.0.0'
  pod 'AppLovinMediationFacebookAdapter', '6.14.0.0'
  pod 'AppLovinMediationGoogleAdapter', '10.9.0.1'
  pod 'AppLovinMediationIronSourceAdapter', '7.4.0.0.1'
  pod 'AppLovinMediationUnityAdsAdapter', '4.8.0.1'
  pod 'AppLovinMediationVungleAdapter', '7.0.1.0'
  pod 'AppLovinSDK', '11.11.2'
  pod 'FBAudienceNetwork', '~> 6.4.1'
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

However, I had to manually remove the pod 'FBAudienceNetwork', '~> 6.4.1' line to make Xcode happy. So my final Podfile looks like this:

source 'https://cdn.cocoapods.org/'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'AppLovinMediationAdColonyAdapter', '4.9.0.0.4'
  pod 'AppLovinMediationByteDanceAdapter', '5.4.0.7.0'
  pod 'AppLovinMediationChartboostAdapter', '9.4.0.0'
  pod 'AppLovinMediationFacebookAdapter', '6.14.0.0'
  pod 'AppLovinMediationGoogleAdapter', '10.9.0.1'
  pod 'AppLovinMediationIronSourceAdapter', '7.4.0.0.1'
  pod 'AppLovinMediationUnityAdsAdapter', '4.8.0.1'
  pod 'AppLovinMediationVungleAdapter', '7.0.1.0'
  pod 'AppLovinSDK', '11.11.2'
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

Changing: 'FBAudienceNetwork', '~> 6.4.1' to 'FBAudienceNetwork', '~> 6.14.0' to match the AppLovin Facebook Adaptor version also worked. Either way, these changes seem to correctly generate the required pod.

After making these changes to the Podfile, I run pod update to install the pods and generate the workspace file.

Open the workspace file (Unity-iPhone.xcworkspace), not the Xcode file (Unity-iPhone.xcodeproj) to open the project in Xcode.

Next, I had to manually drag and drop the Facebook SDK pod frameworks into the Unity-iPhone project:

dragPods Finally, after all of these steps, I was able to compile the build and run it on my iOS device without crashing on start.

Hope this helps!

This Worked for me Thank you!

@DarshanSahay
Copy link

from EDM menu in Unity

This solved my issue as well. Thank you very much.

@mofish9
Copy link

mofish9 commented Dec 2, 2023

I encountered this problem after integrating the Facebook SDK, which didn't seem to play nicely with the AppLovin MAX SDK settings.

A mixture of the above solutions worked for me. I'll list the details below.

Unity Editor: 2021.3.25f1 AppLovin MAX Plugin (Unity): 5.11.2 AppLovin MAX Plugin (iOS): 11.11.2 Facebook SDK: 16.0.1 Xcode Version: 14.2

First, I changed my iOS Resolver settings to the following:

iosResolver These settings are different from what AppLovin's integration instructions recommend, but it was the only way I managed to get things working.

My FacebookSDK > Plugins > Editor > Dependencies.xml file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
        <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" />
        <androidPackage spec="com.facebook.android:facebook-core:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-applinks:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-login:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-share:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-gamingservices:[16.0,17)" />
    </androidPackages>
    <iosPods>
        <iosPod name="FBSDKCoreKit_Basics" version="~> 16.0" />
        <iosPod name="FBSDKCoreKit" version="~> 16.0" />
        <iosPod name="FBSDKLoginKit" version="~> 16.0" />
        <iosPod name="FBSDKShareKit" version="~> 16.0" />
        <iosPod name="FBSDKGamingServicesKit" version="~> 16.0" />
    </iosPods>
</dependencies>

After building the project to iOS, it generates a Podfile looking like this:

source 'https://cdn.cocoapods.org/'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'AppLovinMediationAdColonyAdapter', '4.9.0.0.4'
  pod 'AppLovinMediationByteDanceAdapter', '5.4.0.7.0'
  pod 'AppLovinMediationChartboostAdapter', '9.4.0.0'
  pod 'AppLovinMediationFacebookAdapter', '6.14.0.0'
  pod 'AppLovinMediationGoogleAdapter', '10.9.0.1'
  pod 'AppLovinMediationIronSourceAdapter', '7.4.0.0.1'
  pod 'AppLovinMediationUnityAdsAdapter', '4.8.0.1'
  pod 'AppLovinMediationVungleAdapter', '7.0.1.0'
  pod 'AppLovinSDK', '11.11.2'
  pod 'FBAudienceNetwork', '~> 6.4.1'
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

However, I had to manually remove the pod 'FBAudienceNetwork', '~> 6.4.1' line to make Xcode happy. So my final Podfile looks like this:

source 'https://cdn.cocoapods.org/'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'AppLovinMediationAdColonyAdapter', '4.9.0.0.4'
  pod 'AppLovinMediationByteDanceAdapter', '5.4.0.7.0'
  pod 'AppLovinMediationChartboostAdapter', '9.4.0.0'
  pod 'AppLovinMediationFacebookAdapter', '6.14.0.0'
  pod 'AppLovinMediationGoogleAdapter', '10.9.0.1'
  pod 'AppLovinMediationIronSourceAdapter', '7.4.0.0.1'
  pod 'AppLovinMediationUnityAdsAdapter', '4.8.0.1'
  pod 'AppLovinMediationVungleAdapter', '7.0.1.0'
  pod 'AppLovinSDK', '11.11.2'
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

Changing: 'FBAudienceNetwork', '~> 6.4.1' to 'FBAudienceNetwork', '~> 6.14.0' to match the AppLovin Facebook Adaptor version also worked. Either way, these changes seem to correctly generate the required pod.

After making these changes to the Podfile, I run pod update to install the pods and generate the workspace file.

Open the workspace file (Unity-iPhone.xcworkspace), not the Xcode file (Unity-iPhone.xcodeproj) to open the project in Xcode.

Next, I had to manually drag and drop the Facebook SDK pod frameworks into the Unity-iPhone project:

dragPods Finally, after all of these steps, I was able to compile the build and run it on my iOS device without crashing on start.

Hope this helps!

@tbiz5270

Hi,
I'm facing the same issue and this workaround works for me as well. But one problem: have you succeed to make this process automatically? It’s not a good idea to insert a manual step into the automated build process.

Any idea? Thank you.

@mgrogin
Copy link

mgrogin commented Dec 28, 2023

I encountered this problem after integrating the Facebook SDK, which didn't seem to play nicely with the AppLovin MAX SDK settings.
A mixture of the above solutions worked for me. I'll list the details below.
Unity Editor: 2021.3.25f1 AppLovin MAX Plugin (Unity): 5.11.2 AppLovin MAX Plugin (iOS): 11.11.2 Facebook SDK: 16.0.1 Xcode Version: 14.2
First, I changed my iOS Resolver settings to the following:
iosResolver
These settings are different from what AppLovin's integration instructions recommend, but it was the only way I managed to get things working.
My FacebookSDK > Plugins > Editor > Dependencies.xml file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
        <androidPackage spec="com.parse.bolts:bolts-android:1.4.0" />
        <androidPackage spec="com.facebook.android:facebook-core:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-applinks:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-login:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-share:[16.0,17)" />
        <androidPackage spec="com.facebook.android:facebook-gamingservices:[16.0,17)" />
    </androidPackages>
    <iosPods>
        <iosPod name="FBSDKCoreKit_Basics" version="~> 16.0" />
        <iosPod name="FBSDKCoreKit" version="~> 16.0" />
        <iosPod name="FBSDKLoginKit" version="~> 16.0" />
        <iosPod name="FBSDKShareKit" version="~> 16.0" />
        <iosPod name="FBSDKGamingServicesKit" version="~> 16.0" />
    </iosPods>
</dependencies>

After building the project to iOS, it generates a Podfile looking like this:

source 'https://cdn.cocoapods.org/'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'AppLovinMediationAdColonyAdapter', '4.9.0.0.4'
  pod 'AppLovinMediationByteDanceAdapter', '5.4.0.7.0'
  pod 'AppLovinMediationChartboostAdapter', '9.4.0.0'
  pod 'AppLovinMediationFacebookAdapter', '6.14.0.0'
  pod 'AppLovinMediationGoogleAdapter', '10.9.0.1'
  pod 'AppLovinMediationIronSourceAdapter', '7.4.0.0.1'
  pod 'AppLovinMediationUnityAdsAdapter', '4.8.0.1'
  pod 'AppLovinMediationVungleAdapter', '7.0.1.0'
  pod 'AppLovinSDK', '11.11.2'
  pod 'FBAudienceNetwork', '~> 6.4.1'
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

However, I had to manually remove the pod 'FBAudienceNetwork', '~> 6.4.1' line to make Xcode happy. So my final Podfile looks like this:

source 'https://cdn.cocoapods.org/'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'AppLovinMediationAdColonyAdapter', '4.9.0.0.4'
  pod 'AppLovinMediationByteDanceAdapter', '5.4.0.7.0'
  pod 'AppLovinMediationChartboostAdapter', '9.4.0.0'
  pod 'AppLovinMediationFacebookAdapter', '6.14.0.0'
  pod 'AppLovinMediationGoogleAdapter', '10.9.0.1'
  pod 'AppLovinMediationIronSourceAdapter', '7.4.0.0.1'
  pod 'AppLovinMediationUnityAdsAdapter', '4.8.0.1'
  pod 'AppLovinMediationVungleAdapter', '7.0.1.0'
  pod 'AppLovinSDK', '11.11.2'
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

Changing: 'FBAudienceNetwork', '~> 6.4.1' to 'FBAudienceNetwork', '~> 6.14.0' to match the AppLovin Facebook Adaptor version also worked. Either way, these changes seem to correctly generate the required pod.
After making these changes to the Podfile, I run pod update to install the pods and generate the workspace file.
Open the workspace file (Unity-iPhone.xcworkspace), not the Xcode file (Unity-iPhone.xcodeproj) to open the project in Xcode.
Next, I had to manually drag and drop the Facebook SDK pod frameworks into the Unity-iPhone project:
dragPods
Finally, after all of these steps, I was able to compile the build and run it on my iOS device without crashing on start.
Hope this helps!

@tbiz5270

Hi, I'm facing the same issue and this workaround works for me as well. But one problem: have you succeed to make this process automatically? It’s not a good idea to insert a manual step into the automated build process.

Any idea? Thank you.

This code will link the Frameworks.
Improvements that could be made to the code is getting the framework names and locations automatically instead of hardcoded so it doesn't break in the future.
Most of the names were in the pod file but I didn't see FBAEMKit in the podfile

#define FACEBOOK_WORKAROUND_IOS
#if FACEBOOK_WORKAROUND_IOS
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System.IO;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using UnityEditor.iOS.Xcode.Extensions;

public class PostProcessFacebook : MonoBehaviour
{
    const string FRAMEWORK_PATH_FORMAT = "Pods/{0}/XCFrameworks/{0}.xcframework";
    static string[] frameworks = new string[] {
    "FBAEMKit",
    "FBSDKCoreKit",
    "FBSDKCoreKit_Basics",
    "FBSDKGamingServicesKit",
    "FBSDKLoginKit",
    "FBSDKShareKit",
        };
    [PostProcessBuild(101)]
    private static void PostProcessBuild_Facebook(BuildTarget target, string buildPath)
    {
#if UNITY_EDITOR_OSX
        if (target == BuildTarget.iOS)
        {

            string projPath = PBXProject.GetPBXProjectPath(buildPath);
            PBXProject proj = new PBXProject();
            proj.ReadFromString(File.ReadAllText(projPath));

#if UNITY_2019_3_OR_NEWER
            // Facebook is installed/linked by CocoaPods to the UnityFramework.framework, but the dynamic lib still needs to be embedded into the application target.
            Debug.Log("Embedding facebook frameworks into Unity-iPhone target...");
            string targetGuid = proj.GetUnityMainTargetGuid();
            foreach (var framework in frameworks)
            {
                EmbedFacebookFramework(proj, projPath, targetGuid, string.Format(FRAMEWORK_PATH_FORMAT, framework));

            }
#else
            // Unity projects before 2019.3 do not contain runtime search paths needed for dynamic libraries.
            Debug.Log ("Unity projects before 2019.3 do not contain runtime search paths needed for dynamic libraries.");
            
#endif

            proj.WriteToFile(projPath);
        }
#endif
    }

    private static void EmbedFacebookFramework(PBXProject proj, string projPath, string targetGuid, string framework)
    {
#if UNITY_EDITOR_OSX
        string fileGuid = proj.AddFile(framework, framework, PBXSourceTree.Source);
        PBXProjectExtensions.AddFileToEmbedFrameworks(proj, targetGuid, fileGuid);
#endif
    }
}
#endif

@seokwanhee
Copy link

@mgrogin Thank you! It works.

@EstebanGameDevelopment
Copy link

Environtment:

  • Unity 2022.3.16f1
  • XCode Version 15.0

Plugins:

  • facebook 16.0.2
  • Firebase 10.22.0

Device:

  • iPhone (IOS 17.2.1)

Steps to reproduce:

  • Create a Unity URP Project
  • Switch to IOS
  • Import Firebase
  • Import Facebook
  • Create a scene that uses both
  • Build XCode project
  • Open .xcworkspace
  • Signin
  • Build
  • Install
  • Run and fail with the next log:
Error loading /var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/UnityFramework (141):  dlopen(/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/FBAEMKit.framework/FBAEMKit
  Referenced from: <3ECD5931-404C-38D5-A354-F8FD03880804> /private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/UnityFramework
  Reason: tried: '/usr/lib/swift/FBAEMKit.framework/FBAEMKit' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/usr/lib/swift/FBAEMKit.framework/FBAEMKit' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file)

Error loading /var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/UnityFramework (141):  dlopen(/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/FBAEMKit.framework/FBAEMKit
  Referenced from: <3ECD5931-404C-38D5-A354-F8FD03880804> /private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/UnityFramework
  Reason: tried: '/usr/lib/swift/FBAEMKit.framework/FBAEMKit' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/usr/lib/swift/FBAEMKit.framework/FBAEMKit' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/UnityFramework.framework/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file), '/private/var/containers/Bundle/Application/0801BEBB-5CB7-4B93-B7D6-D52F2257748A/MuseumTechDemo.app/Frameworks/FBAEMKit.framework/FBAEMKit' (no such file)

Expected behaviour:

  • Find the library and run

Other information

source 'https://cdn.cocoapods.org/'

platform :ios, '12.0'

target 'UnityFramework' do
  pod 'FBSDKCoreKit', '~> 16.0.1'
  pod 'FBSDKCoreKit_Basics', '~> 16.0.1'
  pod 'FBSDKGamingServicesKit', '~> 16.0.1'
  pod 'FBSDKLoginKit', '~> 16.0.1'
  pod 'FBSDKShareKit', '~> 16.0.1'
  pod 'Firebase/Analytics', '10.22.0'
  pod 'Firebase/Auth', '10.22.0'
  pod 'Firebase/Core', '10.22.0'
  pod 'Firebase/Database', '10.22.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static

Since this bug has more than 1.5 year and there isn't any update in the SDK since August 2023 I was wondering if the support of Facebook for Unity has officially been cancelled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests