I've built an app in Unity and have installed the Firebase SDK for authentication, analytics, and the database. The build process works just fine in Unity. No errors at all. However, when I open up the project in Xcode and try to archive it, I get these errors:
ld: warning: arm64 function not 4-byte aligned: _unwind_tester from /Users/michael/Desktop/Reserve1/Libraries/libiPhone-lib.a(unwind_test_arm64.o)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRApp", referenced from:
objc-class-ref in libFirebaseCppApp.a(app_ios.mm.o)
"_OBJC_CLASS_$_FIRTransactionResult", referenced from:
objc-class-ref in libFirebaseCppDatabase.a(database_reference_ios.mm.o)
"_OBJC_CLASS_$_FIRTransactionResult", referenced from:
objc-class-ref in libFirebaseCppDatabase.a(database_reference_ios.mm.o)
"_OBJC_CLASS_$_FIRDatabase", referenced from:
objc-class-ref in libFirebaseCppDatabase.a(database_ios.mm.o)
"_OBJC_CLASS_$_FIRGameCenterAuthProvider", referenced from:
objc-class-ref in libFirebaseCppAuth.a(credential_ios.mm.o)
"_OBJC_CLASS_$_FIRGoogleAuthProvider", referenced from:
objc-class-ref in libFirebaseCppAuth.a(credential_ios.mm.o)
"_OBJC_CLASS_$_FIRPhoneAuthProvider", referenced from:
objc-class-ref in libFirebaseCppAuth.a(credential_ios.mm.o)
"_OBJC_CLASS_$_FIRPhoneAuthCredential", referenced from:
objc-class-ref in libFirebaseCppAuth.a(user_ios.mm.o)
"_OBJC_CLASS_$_FIROptions", referenced from:
objc-class-ref in libFirebaseCppApp.a(app_ios.mm.o)
"_OBJC_CLASS_$_FIROAuthProvider", referenced from:
objc-class-ref in libFirebaseCppAuth.a(credential_ios.mm.o)
"_OBJC_CLASS_$_FIRConfiguration", referenced from:
objc-class-ref in libFirebaseCppApp.a(app_ios.mm.o)
"_OBJC_CLASS_$_FIRFacebookAuthProvider", referenced from:
objc-class-ref in libFirebaseCppAuth.a(credential_ios.mm.o)
"_OBJC_CLASS_$_FIRDatabaseReference", referenced from:
objc-class-ref in libFirebaseCppDatabase.a(database_reference_ios.mm.o)
"_OBJC_CLASS_$_FIREmailAuthProvider", referenced from:
objc-class-ref in libFirebaseCppAuth.a(credential_ios.mm.o)
"_OBJC_CLASS_$_FIRGitHubAuthProvider", referenced from:
objc-class-ref in libFirebaseCppAuth.a(credential_ios.mm.o)
"_OBJC_CLASS_$_FIRTwitterAuthProvider", referenced from:
objc-class-ref in libFirebaseCppAuth.a(credential_ios.mm.o)
"_OBJC_CLASS_$_FIRAuth", referenced from:
objc-class-ref in libFirebaseCppAuth.a(auth_ios.mm.o)
"_FIRAuthErrorUserInfoUpdatedCredentialKey", referenced from:
firebase::auth::SignInResultCallback(FIRAuthDataResult*, NSError*, firebase::SafeFutureHandle<firebase::auth::SignInResult>, firebase::auth::AuthData*) in libFirebaseCppAuth.a(auth_ios.mm.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've tried almost everything, including:
- Cocoapod install/delete/reinstall
- IOS Resolver settings changes
- SDK Reinstalls on both Unity and Xcode
- Editing Pod File in multiple ways
- Following every article instructions I came across
I'm using Unity version 2020.3.36f1 and Xcode version 13.4.1
Yet after following solutions on multiple websites including this one for hours, nothing seems to work. I know there's a way. I just can't seem to figure it out.
Please help .
CodePudding user response:
After over 10 hours of research and trial and error I've found the solution. This is probably going to answer hundreds of questions I've seen all over the place that have not been answered. Here we go:
On Mac the issue for me was the Cocoapods failing when trying to Build and Run. Which created all of the errors in Xcode.
Step By Step:
- Open your Xcode project. (Leave open the entire time)
- Locate your Xcode project folder in Finder.
- Right click on the folder and select "New Terminal at Folder"
- If you have an M1 chip type "sudo arch -x86_64 gem install ffi" then "arch -x86_64 pod install" Other wise for Intel "pod install".
You should now see a bunch of green! All of the gems for the framework should be installed.
You will then have a workspace project in your build folder from unity and you can fully build your project in Xcode without it failing.
Hope this helps!