Closed kairi81 closed 3 years ago
Hi @kairi81, I noticed in the second log file, there is this line:
idevtest 6.32.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
idevtest ERROR: Unable to configure Firebase app (The default FirebaseApp instance must be configured before the defaultFirebaseApp instance can be initialized. One way to ensure that is to call [FIRApp configure];
(FirebaseApp.configure()
in Swift) in the App Delegate's application:didFinishLaunchingWithOptions:
(application(_:didFinishLaunchingWithOptions:)
in Swift).)
Can you confirm if that file is configured correctly in your project first?
It is located in the XCode folder as shown in this picture.
And when you open the project in xcode, click on the file, it has the correct target project checked like this?
The target of the GoogleService-Info.plist file is UnityFramework.
However, even when built without using "use_frameworks!", the target is UnityFramework.
Hi @kairi81, sorry it takes a while to get back to you. I tried to repro with both Analytics testapp and Crashlytics testapp, and setup the podfile like below `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' end`
Everything works fine with the testapps. Can you share the exact repro steps to help us dig deeper? Thanks!
I will attach the source code of the sample app I tested.
Only some files are attached due to upload capacity limitation.
Some unique information required at build time has been removed.
I imported Firebase_unity_sdk_6.16.1 because Unity Pakage Manger is not available due to company security policy.
I copied the podFile into the PostProcessBuild(45) sequence because the use_frameworks setting is not available in IOSResolver.
Is there any solution to this issue?
@kairi81
Sorry for the delay! We are aware of issues around use_frameworks!
in general (in my own brief testing, I even had issues linking a solution) and are looking into it. I can't comment on when exactly the issue will be resolved.
If your issue is just reading GoogleService-Info.plist
, you can try one thing. It looks like you have a very centralized place where you call FirebaseApp.DefaultInstance
. It turns out that if you call FirebaseApp.Create
with no name specified and Firebase has not yet been initialized (basically don't call anything other than CheckAndFixDependenciesAsync
), the firebase app that will be created will be the default app.
I'll mark this as a bug for now, but certainly feel free to let me know if that works as a temporary workaround!
--Patrick
Also see issue #902 which seems to be related. The inclusion of the Facebook SDK produces a podfile that includes the !use_frameworks
directive.
@kairi81
Sorry for the delay! We are aware of issues around
use_frameworks!
in general (in my own brief testing, I even had issues linking a solution) and are looking into it. I can't comment on when exactly the issue will be resolved.If your issue is just reading
GoogleService-Info.plist
, you can try one thing. It looks like you have a very centralized place where you callFirebaseApp.DefaultInstance
. It turns out that if you callFirebaseApp.Create
with no name specified and Firebase has not yet been initialized (basically don't call anything other thanCheckAndFixDependenciesAsync
), the firebase app that will be created will be the default app.I'll mark this as a bug for now, but certainly feel free to let me know if that works as a temporary workaround!
--Patrick
I didn't get a word describing how actually is possible to fix it?! Better you prepare well tested versions before releases instead of providing some workaround each time on new version. For entire time working with Firebase SDK I never saw stable release without any issue. Hate Firebase, but have to use it only because of project selected technological stack.
@DellaBitta Thanks a lot. @cynthiajoan
Hi everyone, Does anyone know how I can initialize Firebase? I am following the steps described in the following link (https://goo.gl/ctyzm8).
But when I get to step 5, I don't know how to initialize Firebase.
How can I add the lines of code that are mentioned? I don't know which file they go into and which libraries to import.
I'm using: Unit 2019.4.16f1 Firebase 6.16.1 Cocoapods
Note: I am opening the .xcworkspace from my project in Xcode 12.3
Thanks a lot.
@patm1987
When an Exception occurs in FirebaseApp.DefaultInstance FirebaseApp.Create() was called and Instance returned normally. However, when a Test Exception is made, the event is not caught on the dashboard.
I am testing it to build without using use_frameworks!.
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);
}
}
@eladleb Thank you for providing a workaround here.
I had investigated this issue in the past few days and here are my findings.
When use_frameworks!
is used in Podfile, either added manually or by Facebook SDK, there are two options to make Firebase function properly.
Use @eladleb's workaround. Make sure you have an empty Unity-iPhone
target in Podfile, which is usually added by Facebook SDK.
Your Podfile would looks like
target 'UnityFramework' do
# Pods added by EDM4U, like 'Firebase/Analytics' or 'FBSDKCoreKit'
end
target 'Unity-iPhone' do
# Empty Target. Required or the app crash due to missing library.
end
use_frameworks!
Change use_frameworks!
to use_frameworks! :linkage => :static
in Podfile. No additional Unity code or empty Unity-iPhone
target needed. It required Cocoapods 1.9
and above.
Your Podfile would looks like
target 'UnityFramework' do
# Pods added by EDM4U, like 'Firebase/Analytics' or 'FBSDKCoreKit'
end
use_frameworks! :linkage => :static
Use option 1 if you really like to link libraries dynamically, you re-generate Xcode frequently, or you are using older version of Cocoapods. Use option 2 for stability and performance. This will be the default solution I'm going forward to add to EDM4U as a new option in iOSResolver.
Here is what we know so far
UnityFramework
target on top of Unity-iPhone
target in Xcode project. More detail here. Unity-iPhone
is changed to be a thin launcher to load UnityFramework
.UnityFramework
include all classes and libraries from Unity, including all of Firebase Unity and native C++ SDK, such as libFirebaseCppApp.a
. They will be a member of UnityFramework
target by default when Xcode project is generated.pod install
to generate Unity-iPhone.xcworkspace.Google-Services.plist
to Xcode project and add it to be a member of UnityFramework
target from Unity 2019.3. (Unity-iPhone
for Unity 2019.2 and below)use_framework!
is required for Swift libraries. Firebase SDK currently does not require it yet.use_framework!
and empty Unity-iPhone
target to Podfile. I guess they do so because they switch to Swift library.use_framework!
is used, libraries are linked dynamically by default unless :linkage => :static
is specified.Google-Services.plist
needs to be added to Unity-iPhone
target to create FirebaseApp. Also, an empty Unity-iPhone
target is required in Podfile or the app can crash due to missing libraries. This is really odd. Though we do not know the reason why these are required yet but this might be related to UnityFramework.framework
being embedded to Unity-iPhone
use_frameworks! :linkage => :static
to link libraries statically.There are still some mysteries about this issue. If you have any insight about this, feel free to share here!
I'll leave this issue open until we have a proper support for it.
Using facebook v9 also face the same crash
@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.
Can someone please clarify? Adding _useframeworks! :linkage => :static is supposed to make Firebase 7.0.2 and Facebook 9.0.0 build?
It doesn't work for me. I continue to get this error:
Undefined symbol: _OBJCCLASS$_GKLocalPlayer
@andymads
It doesn't work for me. I continue to get this error:
Undefined symbol: OBJC_CLASS$_GKLocalPlayer
I think this is a different issue caused from missing framework.
Try adding GameKit.framework to your xcode prject from
Targets
-> UnityFramework
-> General
-> Frameworks and Libraries
-> click +
button and find GameKit.framework
-> rebuild.
Hope this solves your problem.
@andymads
It doesn't work for me. I continue to get this error: Undefined symbol: OBJC_CLASS$_GKLocalPlayer
I think this is a different issue caused from missing framework.
Try adding GameKit.framework to your xcode prject from
Targets
->UnityFramework
->General
->Frameworks and Libraries
-> click+
button and findGameKit.framework
-> rebuild.Hope this solves your problem.
Yes, thanks very much. Didn't work until I did a clean first, then build.
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);
Any updates on this issue for iOS?
I'm also facing the issue with GoogleService-Info.plist
added in UnityFramework
instead of Unity-iPhone
target like @kairi81 said in https://github.com/firebase/quickstart-unity/issues/862#issuecomment-725928638
Unity 2019.4.17f1 Firebase 7.0.2 (via UPM): Core, Analytics, RemoteConfig Facebook SDK 9.0.0 AdMob 5.4.0
My game doesn't crash but RemoteConfig failed due to Failed to read Firebase options from the app's resources. Either make sure GoogleService-Info.plist is included in your build or specify options explicitly.
Will try the workarounds with PostProcessBuild above but it would be great to get this sorted out by Firebase.
Update: The workaround works perfectly. Thanks @AlexZonov @eladleb
I'm also facing the issue with
GoogleService-Info.plist
added inUnityFramework
instead ofUnity-iPhone
target like @kairi81 said in #862 (comment)Unity 2019.4.17f1 Firebase 7.0.2 (via UPM): Core, Analytics, RemoteConfig Facebook SDK 9.0.0 AdMob 5.4.0
My game doesn't crash but RemoteConfig failed due to
Failed to read Firebase options from the app's resources. Either make sure GoogleService-Info.plist is included in your build or specify options explicitly.
Will try the workarounds with PostProcessBuild above but it would be great to get this sorted out by Firebase.
I reported this problem and got this reply so I'm not sure that Firebase are interested in sorting it out.
It looks like you're having issues integrating third party libraries with Firebase SDKs. Integrations like this are not covered by Firebase Support at the moment. This is currently beyond our scope of free support as it makes use of a third-party library, and I have limited expertise. I recommend to raise your question to other public communities such as GitHub or Stack Overflow where fellow developers will be able to directly provide suggestions or ideas pertaining to this topic.
@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.
@chkuang-g Any clue when we'd be seeing this fix, or able to get a beta UMP version?
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 After trying your solution I get this errors :
Linking UnityFramework
⚠️ ld: arm64 function not 4-byte aligned: _unwind_tester from /Users/runner/work/Need-For-Fruits/Need-For-Fruits/build/iOS/iOS/Libraries/libiPhone-lib.a(unwind_test_arm64.o)
⚠️ ld: Could not find or use auto-linked library 'swiftCompatibility50'
⚠️ ld: Could not find or use auto-linked library 'swiftObjectiveC'
⚠️ ld: Could not find or use auto-linked library 'swiftCompatibility51'
⚠️ ld: Could not find or use auto-linked library 'swiftCoreFoundation'
⚠️ ld: Could not find or use auto-linked library 'swiftDarwin'
⚠️ ld: Could not find or use auto-linked library 'swiftWebKit'
⚠️ ld: Could not find or use auto-linked library 'swiftUIKit'
⚠️ ld: Could not find or use auto-linked library 'swiftMetal'
⚠️ ld: Could not find or use auto-linked library 'swiftCoreGraphics'
⚠️ ld: Could not find or use auto-linked library 'swiftDispatch'
⚠️ ld: Could not find or use auto-linked library 'swiftCoreImage'
⚠️ ld: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
⚠️ ld: Could not find or use auto-linked library 'swiftAccelerate'
⚠️ ld: Could not find or use auto-linked library 'swiftAVFoundation'
⚠️ ld: Could not find or use auto-linked library 'swiftCore'
⚠️ ld: Could not find or use auto-linked library 'swiftFoundation'
⚠️ ld: Could not find or use auto-linked library 'swiftCoreMedia'
⚠️ ld: Could not find or use auto-linked library 'swiftsimd'
⚠️ ld: Could not find or use auto-linked library 'swiftCoreAudio'
⚠️ ld: Could not find or use auto-linked library 'swiftQuartzCore'
⚠️ ld: Could not find or use auto-linked library 'swiftos'
⚠️ ld: Could not find or use auto-linked library 'swiftPhotos'
⚠️ ld: Could not find or use auto-linked library 'swiftCoreMIDI'
⚠️ ld: Could not find or use auto-linked library 'swiftUniformTypeIdentifiers'
⚠️ ld: Could not find or use auto-linked library 'swiftCoreLocation'
❌ ld: symbol(s) not found for architecture arm64
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
** ARCHIVE FAILED **
[09:36:49]: ▸ __swift_FORCE_LOAD_$_swiftMetal_$_FBSDKLoginKit in FBSDKLoginKit(LoginManager.o)
[09:36:49]: ▸ __swift_FORCE_LOAD_$_swiftMetal_$_FBSDKShareKit in FBSDKShareKit(Enums+Extensions.o)
[09:36:49]: ▸ (maybe you meant: __swift_FORCE_LOAD_$_swiftMetal_$_FBSDKLoginKit, __swift_FORCE_LOAD_$_swiftMetal_$_FBSDKShareKit , __swift_FORCE_LOAD_$_swiftMetal_$_FBSDKCoreKit )
[09:36:49]: ▸ ld: symbol(s) not found for architecture arm64
[09:36:49]: ▸ clang: error: linker command failed with exit code 1 (use -v to see invocation)
[09:36:49]:
[09:36:49]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
My Podfile :
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'
target 'UnityFramework' do
pod 'FBSDKCoreKit', '~> 9.0'
pod 'FBSDKGamingServicesKit', '~> 9.0'
pod 'FBSDKLoginKit', '~> 9.0'
pod 'FBSDKShareKit', '~> 9.0'
pod 'Firebase/Analytics', '7.0.0'
pod 'Firebase/Core', '7.0.0'
pod 'Firebase/RemoteConfig', '7.0.0'
end
use_frameworks! :linkage => :static
@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 I think they don't support upm anymore check this issue https://github.com/firebase/quickstart-unity/issues/948
@uchar I don't think so. Current 7.0.2 still published on UPM
It should be available through UPM in an hour. Sorry for the inconvenience.
Shawn
@uchar
If you are using Firebase with Facebook SDK, you should use
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'
target 'UnityFramework' do
pod 'FBSDKCoreKit', '~> 9.0'
pod 'FBSDKGamingServicesKit', '~> 9.0'
pod 'FBSDKLoginKit', '~> 9.0'
pod 'FBSDKShareKit', '~> 9.0'
pod 'Firebase/Analytics', '7.0.0'
pod 'Firebase/Core', '7.0.0'
pod 'Firebase/RemoteConfig', '7.0.0'
end
target 'Unity-iPhone' do
end
use_frameworks!
Facebook editor tool should add that target 'Unity-iPhone'
and use_frameworks!
section. And the EDM4U coming with Firebase 7.1.0
should use this option by default as well. You may see duplicated lines of use_frameworks!
though, which should not hurt.
It should be available through UPM in an hour. Sorry for the inconvenience.
Shawn
Thank you very much but still, every version of firebase have this UPM lag for a day or more. I mean literally every version. I have open https://firebase.google.com/support/releases everyday on daily basis. And when I found new unity release. I then prepare to stop every other task and continue my work in unity. But then after unity finish loading my project (which already takes times) I feel so disappointed that it not ready in UPM
Could we do anything about this? Why firebase UPM have to build for more than 24 hours in every single version?
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.
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.
Thank you very much
[REQUIRED] Please fill in the following fields:
[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.
Firebase_UseFrameworks.txt
If you use podFile like this The app runs, but Firebase.FirebaseApp.DefaultInstance; Exception occurs when calling.
Firebase_UseFrameworks_UnityIPhone.txt Attach log files for the above two situations.