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

XCode project fails to be exported in Unity with recommended ExternalDependencyManager settings when using Firebase libraries #290

Closed
YevhenParfonov opened this issue Oct 5, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@YevhenParfonov
Copy link

YevhenParfonov commented Oct 5, 2023

MAX Plugin Version

5.11.4 (Unity)

Unity Version

2021.3.20

Device/Platform Info

Unity Editor, during exporting XCode project

Current Behavior

Hello!
I've got a project where i use Applovin SDK and some Firebase modules. Following the iOS integration documentation, i've got a problem with documented settings of ExternalDependencyManager.
As it's stated in docs i should disable two options in dependency manager:

  1. Add use_frameworks! to Podfile
  2. Always add the main target to Podfile

If doing so, the XCode project wont be exported telling me that:

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `FirebaseCoreInternal` depends upon `GoogleUtilities`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

The Swift pod `FirebaseSessions` depends upon `FirebaseCore`, `FirebaseCoreExtension`, `FirebaseInstallations`, `GoogleDataTransport`, `GoogleUtilities`, and `nanopb`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

The Swift pod `FirebaseStorage` depends upon `FirebaseAppCheckInterop`, `FirebaseAuthInterop`, `FirebaseCore`, `FirebaseCoreExtension`, and `GTMSessionFetcher`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

[!] 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).

During my research, i've found this issue: #252
In the end, there is a suggestion to add the Unity postprocessor which will append the use_modular_headers! line to the exported project podfile.

After doing so i've managed to export the XCode project. But new problem appears - if i try to compile it, it gives me this error:

.../builds/BuildFromMenu/Pods/gRPC-Core/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c module map file '.../builds/BuildFromMenu/Pods/Headers/Private/openssl_grpc/BoringSSL-GRPC.modulemap' not found

After some experiments (and info from this issue), i've decided to try to turn on the Add use_frameworks! to Podfile option in DependencyManager and removed the postprocessor that adds the use_modular_headers! line.
After doing so i was able to export the XCode project and compile it successfully and launch the app without any crash. Inspecting the builtin Applovin manager debugger i can see that all mediation networks are active and some ads are displaying.

So I wanted to ask if enabling this Add use_frameworks! to Podfile option in DependencyManager could lead to some hidden unexpected problems in the application later?

PS
Btw, if i enable both the Add use_frameworks! to Podfile and Always add the main target to Podfile options, i could export the XCode project and compile it, but it crashes on startup with these error:

Error loading /var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/UnityFramework.framework/UnityFramework:  dlopen(/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: '@rpath/HyprMX.framework/HyprMX'
  Referenced from: '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/UnityFramework.framework/UnityFramework'
  Reason: tried: '/usr/lib/swift/HyprMX.framework/HyprMX' (no such file), '/usr/lib/swift/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/UnityFramework.framework/Frameworks/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/../../Frameworks/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/UnityFramework.framework/Frameworks/HyprMX.framework/HyprMX' (no such file), '/usr/lib/swift/HyprMX.framework/HyprMX' (no such file), '/usr/lib/swift/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/UnityFramework.framework/Frameworks/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/../../Frameworks/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/UnityFramework.framework/Frameworks/HyprMX.framework/HyprMX' (no such file), '/private/var/containers/Bundle/Application/5ADA2911-E1CE-4889-B29B-8982E1C0B4A9/Template.app/Frameworks/HyprMX.framework/HyprMX' (no such file), '/System/Library/Frameworks/HyprMX.framework/HyprMX' (no such file)

Regards,
Yevhen

Expected Behavior

I should be able to export valid and working XCode project using the settings of iOS DependencyManager stated in documentation.

How to Reproduce

  1. Create new Unity project
  2. Adds these firebase products in Unity:
    • com.google.firebase.firestore
    • com.google.firebase.functions
    • com.google.firebase.storage
    • com.google.firebase.app
    • com.google.firebase.auth
    • com.google.firebase.messaging
    • com.google.firebase.crashlytics
    • com.google.firebase.dynamic-links
    • com.google.firebase.installations
    • com.google.firebase.instance-id
    • com.google.firebase.database
    • com.google.firebase.remote-config
    • com.google.firebase.analytics
  3. Integrate Apploving Unity SDK
  4. In External Dependenct Manager for iOS, disable these options:
    • Add use_frameworks! to Podfile
    • Always add the main target to Podfile
  5. Add these mediation partners:
    • HyperMx

5.1) Optionally: mb other mediation parters also influence the problem
- AdColony
- BidMachine
- ChartBoost
- Criteo
- CSJ
- Facebook
- AdMob (20.3.0.0 Android and 10.12.0.0 iOS)
- InMobi
- ironSource
- LINE
- Mintegral
- MobileFuse
- Nend
- Smaato
- Tencent
- Pangle
- Unity Ads
- Verve
- Liftoff

  1. Build project - export XCode project

Additional Info

No response

@YevhenParfonov YevhenParfonov added the bug Something isn't working label Oct 5, 2023
@YevhenParfonov YevhenParfonov changed the title XCode project fails to be exported in Unity with recommended ExternalDependencyManager when using firebase libraries XCode project fails to be exported in Unity with recommended ExternalDependencyManager settings when using Firebase libraries Oct 5, 2023
@santoshbagadi
Copy link
Contributor

Hi @YevhenParfonov , you may need to add use_modular_headers! to the Podfile. You can use the code here: #252 (comment) to automate it.

@YevhenParfonov
Copy link
Author

Hello, santoshbagadi!
I've already tried and it didn't help me:

During my research, i've found this issue: #252
In the end, there is a suggestion to add the Unity postprocessor which will append the use_modular_headers! line to the exported project podfile.
After doing so i've managed to export the XCode project. But new problem appears - if i try to compile it, it gives me this error:

.../builds/BuildFromMenu/Pods/gRPC-Core/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c module map file '.../builds/BuildFromMenu/Pods/Headers/Private/openssl_grpc/BoringSSL-GRPC.modulemap' not found

Thanks,
Yevhen

@SmoothyD
Copy link

SmoothyD commented Oct 6, 2023

Hello, we have similar issues here.

When disabling use_frameworks!, the project is not exported correctly with the same errors. If we had use_modular_headers! to the Podfile, the project can now be exported, but the game crashes at startup, with this log:

2023-10-06 11:59:36.147744+0200 Endless Wander[906:202454] AppLovinQualityService top: AppLovinQualityService Client Version: 6.12.6
2023-10-06 11:59:36.147799+0200 Endless Wander[906:202454] AppLovinQualityService top: AppLovinQualityService Device ID: 9D3CF742-C6C5-49FB-ADC2-0EC3AA685E30
2023-10-06 11:59:36.265633+0200 Endless Wander[906:202454] [general] Error loading /var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/UnityFramework (141):  dlopen(/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: <F0CB3C26-5245-372B-A146-AD0303051CD1> /private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/UnityFramework
  Reason: tried: '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/libswiftCore.dylib' (no such file), '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/Frameworks/libswiftCore.dylib' (no such file), '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/libswiftCore.dylib' (no such file), '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/Frameworks/libswiftCore.dylib' (no such file), '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/libswiftCore.dylib' (no such file)
2023-10-06 11:59:36.311564+0200 Endless Wander[906:202454] [general] Error loading /var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/UnityFramework (141):  dlopen(/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: <F0CB3C26-5245-372B-A146-AD0303051CD1> /private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/UnityFramework
  Reason: tried: '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/libswiftCore.dylib' (no such file), '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/Frameworks/libswiftCore.dylib' (no such file), '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/libswiftCore.dylib' (no such file), '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/UnityFramework.framework/Frameworks/libswiftCore.dylib' (no such file), '/private/var/containers/Bundle/Application/C1C2357F-A027-4A47-9BCA-971A8B3A1217/Endless Wander.app/Frameworks/libswiftCore.dylib' (no such file)`

When enabling use_frameworks!, and the static linking of frameworks, the build works, and the game runs correctly.

@daltonbr
Copy link

daltonbr commented Dec 6, 2023

I manage to get it working by running pod install before build.
For more details, check my other post here.

@santoshbagadi
Copy link
Contributor

We have updated our plugin (v6.4.3) to be able to work with the default EDM settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants