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

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 mayyang opened 2 years ago

mayyang commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 1 year ago

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

Phoder1 commented 1 year ago

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 commented 1 year ago

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

DmitrySharov commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

NguyenTongTran commented 1 year ago

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 commented 1 year ago

Hello …. I see a lot of email that you send me but I am not a professional and I can’t fix them ….. sorry for this ….. maybe if you have any video step by step I try to make it. Στάλθηκε από το iPhone μου30 Μαΐ 2023, 6:42 πμ, ο χρήστης «NguyenTongTran @.***>» έγραψε: 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

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

liutiangang commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

TahaHassan672 commented 1 year ago

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 commented 1 year ago

from EDM menu in Unity

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

mofish9 commented 11 months ago

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 commented 10 months ago

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 commented 9 months ago

@mgrogin Thank you! It works.

EstebanGameDevelopment commented 6 months ago

Environtment:

Plugins:

Device:

Steps to reproduce:

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:

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?