"_OBJC_CLASS_$_FIROptions" Error 解決策 ( Unity Build -> Xcode )
Error内容
ld: warning: arm64 function not 4-byte aligned: ltmp0 from /Users/tai/unityProjects/Application-iOS/Escapeman/Libraries/libiPhone-lib.a(unwind_test_arm64.o)
ld: warning: arm64 function not 4-byte aligned: _unwind_tester from /Users/tai/unityProjects/Application-iOS/Escapeman/Libraries/libiPhone-lib.a(unwind_test_arm64.o)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIROptions", referenced from:
objc-class-ref in libApp.a(app_ios_c76c7d869e568a9b561ea55e25a7dcc0.o)
"_OBJC_CLASS_$_FIRInstanceID", referenced from:
objc-class-ref in libMessaging.a(messaging_0d72481c6b9f9d4c5456dcb81aa103f1.o)
"_OBJC_CLASS_$_FIRApp", referenced from:
objc-class-ref in libApp.a(app_ios_c76c7d869e568a9b561ea55e25a7dcc0.o)
"_OBJC_CLASS_$_FIRMessaging", referenced from:
objc-class-ref in libMessaging.a(messaging_0d72481c6b9f9d4c5456dcb81aa103f1.o)
"_kFIRInstanceIDTokenRefreshNotification", referenced from:
____ZN8firebase9messaging17NotifyListenerSetEPNS0_8ListenerE_block_invoke in libMessaging.a(messaging_0d72481c6b9f9d4c5456dcb81aa103f1.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解決方法
CocoaPodsを実行する
原因
framework不足
解説
「symbol(s) not found」 ← この原因はだいたい framework や source 不足。
上記のErrorはFirebase関連のFramework不足です。
XcodeのRootに Podfile を設置して pod install コマンドを実行してください。
以上。
※以下 今回(タイトルのError)限定の具体的な解決方法
Podfile内容
pods.command
配置
上記の様にPodfileとpods.commandを設置して、pods.commandをダブルクリックしてください。
pods.commandを実行すると同ディレクトリに 「Pods」 フォルダができます。
Xcode上でPodsフォルダの追加
PodsフォルダをXcode上に ドラッグ&ドロップ する
※ドラッグ&ドロップ後 Xcodeのプロジェクトをクリーンすると確実に反映される。
以上。
補足
タイトルのErrorは消えるが、他のエラーが発生します!
その他のErrorを消すには
Compile Sources の GTMLogger.m に 「-fno-objc-arc」 を付加
Build Setting の Enable Objective-C Exceptions を Yes にする
GoogleService-Info.plistを設置する