quickstart-unity: iOS App Crash ( podFile to use_frameworks! Issue when used )

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.4.3.f1
  • Firebase Unity SDK version: 6.16.1
  • Source you installed the SDK: .unitypackage
  • Problematic Firebase Component: Analytics, Crashlytics
  • Other Firebase Components in use: Analytics, Crashlytics
  • Additional SDKs you are using: None
  • Platform you are using the Unity editor on: Windows & Mac
  • Platform you are targeting: iOS, Android
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

podFile to use_frameworks! Can’t use the option?

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Yes What’s the issue repro rate? 100%

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

If you have a downloadable sample project that reproduces the bug you’re reporting, you will likely receive a faster response on your issue.

Relevant Code:

If you use podFile like this As soon as the app launches, it quits.

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

use_frameworks!

target'UnityFramework' do
   pod'Firebase/Analytics', '6.32.2'
   pod'Firebase/Core', '6.32.2'
   pod'Firebase/Crashlytics', '6.32.2'
end

Firebase_UseFrameworks.txt

If you use podFile like this The app runs, but Firebase.FirebaseApp.DefaultInstance; Exception occurs when calling.

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

use_frameworks!

target'Unity-iPhone' do
   pod'Firebase/Analytics', '6.32.2'
   pod'Firebase/Core', '6.32.2'
   pod'Firebase/Crashlytics', '6.32.2'
end

target'UnityFramework' do
   pod'Firebase/Analytics', '6.32.2'
   pod'Firebase/Core', '6.32.2'
   pod'Firebase/Crashlytics', '6.32.2'
end

Firebase_UseFrameworks_UnityIPhone.txt Attach log files for the above two situations.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 35 (16 by maintainers)

Most upvoted comments

This can be solved by adding GoogleService-Info.plist a resource of the main target. I added a post build script to do it for now, until Firebase comes up with a better way of handling this…

[PostProcessBuild]
public static void OnPostProcessBuildAddFirebaseFile(BuildTarget buildTarget, string pathToBuiltProject)
{
       if (buildTarget == BuildTarget.iOS) 
       {
          // Go get pbxproj file
          string projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
  
          // PBXProject class represents a project build settings file,
          // here is how to read that in.
          PBXProject proj = new PBXProject ();
          proj.ReadFromFile (projPath);
  
          // Copy plist from the project folder to the build folder
          proj.AddFileToBuild (proj.GetUnityMainTargetGuid(), proj.AddFile("GoogleService-Info.plist", "GoogleService-Info.plist"));
  
          // Write PBXProject object back to the file
          proj.WriteToFile (projPath);
     }
}

This can be solved by adding GoogleService-Info.plist a resource of the main target. I added a post build script to do it for now, until Firebase comes up with a better way of handling this…

[PostProcessBuild]
public static void OnPostProcessBuildAddFirebaseFile(BuildTarget buildTarget, string pathToBuiltProject)
{
       if (buildTarget == BuildTarget.iOS) 
       {
          // Go get pbxproj file
          string projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
  
          // PBXProject class represents a project build settings file,
          // here is how to read that in.
          PBXProject proj = new PBXProject ();
          proj.ReadFromFile (projPath);
  
          // Copy plist from the project folder to the build folder
          proj.AddFileToBuild (proj.GetUnityMainTargetGuid(), proj.AddFile("GoogleService-Info.plist", "GoogleService-Info.plist"));
  
          // Write PBXProject object back to the file
          proj.WriteToFile (projPath);
     }
}

string googleInfoPlistGuid = proj.FindFileGuidByProjectPath(“GoogleService-Info.plist”); proj.AddFileToBuild(targetGuid, googleInfoPlistGuid);

@andymads

I have a patch in review to fix the issue with GoogleService-Info.plist.

Also, there are a couple of upcoming patches for EDM4U to support wider spectrum of Pod configurations.

Publishing process for UPM is slightly different from the one for the .unitypackage. I forwarded your concerns to the team and will plan on improving the publishing process.

We are preparing 7.1.0 release now.

Before that, please use https://github.com/firebase/quickstart-unity/issues/862#issuecomment-752945417 as a workaround.

Shawn

@chkuang-g Firebase page said it release https://firebase.google.com/support/release-notes/unity#7.1.0 but UPM still not update

Could you please just have any reminder in your team or build trigger to always update UPM whenever you have release any version?

@Thaina

Thanks for reporting this.

I just ran some test with Facebook SDK 9.0.0, seems like https://github.com/firebase/quickstart-unity/issues/862#issuecomment-752945417 is the only working solution now. use_frameworks! :linkage => :static does not seem to work with the latest Facebook SDK.

I’ll add some fixes from both EDM4U and Firebase side.