LoginSignup
2
1

More than 1 year has passed since last update.

Unity iOS Xcode ビルドエラーまとめ

Last updated at Posted at 2022-08-21

はじめに

今回、初めてUnityで作成したゲームをiOS向けにリリースする中でかなりのエラーに苦しまされたので、対応方法を下記にまとめてみました。
参考になれば幸いです。
また、同様の事象や他の解決策があれば是非コメントで共有お願いいたします。

目次

1.開発環境
2.Cocoapodsに関するエラー
3.Xcode上でVaridate Appを行なった際に発生するエラー1
4.Xcode上でVaridate Appを行なった際に発生するエラー2
5.Apple Reviewでの審査棄却 ”Guideline 2.1”
6.Apple Reviewでの審査棄却 ”Guideline 5.1.2”
7.Appleから届いたログファイルのシンボル化
8.Xcode上でVaridate Appを行なった際に発生するエラー3
9.Xcode上でAchiveを行なった際に発生するエラー1
10.iPhoneの「設定」にsandboxの設定が出てこない

開発環境

PC:Macbook air(M1)
OS:macOS Monterey v12.5
Unity:2021.3.7f1(Apple silicon)
Xcode:v13.4.1
GoogleMobileAds:v6.1.2
Cocoapods:v1.11.3

1.Cocoapodsに関するエラー

■詳細
Unity上でiOS向けにビルドした際、ビルドは成功するが、コンソール上で下記のようなエラーが返ってくる。

iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.
After the failure, "pod repo update" was executed and succeeded. "pod install" was then attempted again, and still failed. This may be due to a broken CocoaPods installation. See: https://guides.cocoapods.org/using/troubleshooting.html for potential solutions.
pod install output:
[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8

また、そのままXcodeでビルドしようとするとXcode上で下記エラーが発生しビルドに失敗する。

  "_OBJC_CLASS_$_GADMediaView", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADRequest", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADNativeAdImageAdLoaderOptions", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADNativeAdViewAdOptions", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADBannerView", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADInterstitialAd", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADNativeAdView", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_kGADAdSizeMediumRectangle", referenced from:
      -[ALGoogleMediationAdapter adSizeFromAdFormat:withServerParameters:] in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADMobileAds", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_kGADAdSizeLeaderboard", referenced from:
      -[ALGoogleMediationAdapter adSizeFromAdFormat:withServerParameters:] in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADAdLoader", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth", referenced from:
      -[ALGoogleMediationAdapter adSizeFromAdFormat:withServerParameters:] in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
      +[ALGoogleMediationAdapter currentOrientationAchoredAdaptiveBannerSizeWithWidth:] in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADQueryInfo", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADExtras", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_kGADAdSizeBanner", referenced from:
      -[ALGoogleMediationAdapter adSizeFromAdFormat:withServerParameters:] in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_OBJC_CLASS_$_GADRewardedAd", referenced from:
      objc-class-ref in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
  "_kGADAdLoaderAdTypeNative", referenced from:
      -[ALGoogleMediationAdapter loadAdViewAdForParameters:adFormat:andNotify:] in AppLovinMediationGoogleAdapter(ALGoogleMediationAdapter.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

■症状
症状1:上記Cocoapodsに関するエラーがコンソール上に吐かれる
症状2:xcworkspaceファイルが生成されていない
症状3:そのままXcodeでビルドしようとすると失敗する

■対応方法
①Unity上のアセット>External Dependency Manager>iOS Resolver>設定で ”Xcode Workspace -Add..."から "Xcode Project - Add..." に変更する。
②同じ画面上にある "Linkframeworks staticly" を有効にする
③その後、下記対応方法を実施する
https://kan-kikuchi.hatenablog.com/entry/CocoaPods_installation_failure

■備考
注意:xcworkspaceファイルからXcodeを開くようにして下さい。
   Xcode上でビルドする際はUnityを閉じていた方が良さそうです。

自分の場合、上記対応方法のうち、CocoaPodsを入れ直すところから実施することで解決しました。
ただし、上記対応方法と同じく自分もターミナルから手動でCocoaPodsをインストールすることで解決しました。
毎度これを実施しないといけないので少し手間ですが、とりあえず解決して何よりです。。。

2.Xcode上でVaridate Appを行なった際に発生するエラー1

■詳細
XcodeでVaridate Appを行ったところ、下記のエラーが発生した。

Invalid Bundle. The bundle at '◯◯.app/Frameworks/UnityFramework.framework' contains disallowed file 'Frameworks'.

■対応方法
https://marumaro7.hatenablog.com/entry/disallowed_frameworks_error

3.Xcode上でVaridate Appを行なった際に発生するエラー2

■詳細
XcodeでVaridate Appを行ったところ、下記のエラーが発生した。

This bundle is invalid. The value for key CFBundleShortVersionString [X] in the Info.plist file must contain a higher version than that of the previously approved version [X].

■対応方法
https://redfreshet.com/2019/10/01/koke-ios-publish/

4.Apple Reviewでの審査棄却 ”Guideline 2.1”

■詳細
アプリ審査の結果、下記内容で棄却された。
アプリがクラッシュしてしまい、審査できなかった模様。

Guideline 2.1 - Performance - App Completeness
We were still unable to review your app as it crashed on launch. We have attached detailed crash logs to help troubleshoot this issue.

Review device details:
- Device type: iPad
- OS version: iOS 15.6

Next Steps
To address the crash in your app, follow these steps:

1. Fully symbolicate the crash report. See Adding Identifiable Symbol Names to a Crash Report for an explanation of the symbolication process.
2. Match the crash report to a common pattern. Based on the pattern, take specific actions to further investigate the crash. See Identifying the Cause of Common Crashes.
3. Test your app on a device to ensure that it now runs as expected.
4. Once you’ve addressed the crash, create and submit a new build to the App Store for review.

Resources
For additional information on crash reports, see Diagnosing Issues Using Crash Reports and Device Logs.

■対応方法
①添付されているログファイルをシンボル化してアプリがクラッシュする箇所を確認し、原因究明する。
②ログファイルを確認したところ、"EXC_CRASH (SIGKILL)" が原因でクラッシュしていたため、AdMobのSDKをv7.1.0からv6.1.2に変更した。
⇒"EXC_CRASH (SIGKILL)"はSDK周りのエラーのよう
⇒詳細はこちら:https://develop.hateblo.jp/entry/apple-reject-log)
③再度ビルドし、再申請する。

■備考
ログファイルのシンボル化手順はこちら:https://qiita.com/orimomo/items/9f88c740ad41cfd25328
⇒自分はこのやり方でうまくいきませんでしたので、本記事に対応方法を記載しています。

注意:棄却理由の内容はメールにも送られてくるが、メールにはログファイルが添付されていない。
   ログファイルはApp Store Connectでしか確認できない。
   メール内の "App Review Page" というリンクを踏むとApp Store Connectにアクセスできる。

AdMobのSDKを変更して審査は合格したが、引き続きクラッシュについて注視しておくように案内が来ていました。
あくまで推測ですが、クラッシュ自体はまだ解決されておらず、とりあえず審査通してくれたようです。

5.Apple Reviewでの審査棄却 ”Guideline 5.1.2”

■詳細
アプリ審査の結果、下記内容で棄却された。
ATTが表示されない、もしくは未実装だという指摘。
しかし、ATTは実装済みで、自分の端末(iPhone/iPad)でATTが表示されることも確認済みだった。。。

Guideline 5.1.2 - Legal - Privacy - Data Use and Sharing
The app privacy information you provided in App Store Connect indicates you collect data in order to track the user, including Advertising Data, Product Interaction, and Other Usage Data. However, you do not use App Tracking Transparency to request the user's permission before tracking their activity.

Starting with iOS 14.5, apps on the App Store need to receive the user’s permission through the AppTrackingTransparency framework before collecting data used to track them. This requirement protects the privacy of App Store users.

Next Steps
Here are two ways to resolve this issue:
- If you do not currently track, or decide to stop tracking, update your app privacy information in App Store Connect. You must have the Account Holder or Admin role to update app privacy information.
- If you track users, you must implement App Tracking Transparency and request permission before collecting data used to track. When you resubmit, indicate in the Review Notes where the permission request is located.

Resources
- Tracking is linking data collected from your app with third-party data for advertising purposes, or sharing the collected data with a data broker. Learn more about tracking.
- See Frequently Asked Questions about the requirements for apps that track users.
- Learn more about designing appropriate permission requests.

■対応方法
審査の再申請を行う際、”App Reviewに関する情報” の項目にあるメモで下記内容を記載し、再申請を行なった。

"App Tracking Transparency" は導入済みで、アプリ起動時に表示されます。

■確認端末
・iPhone(iOS XX.X)
・iPad(iPadOS XX.X)

ATTが表示されているスクリーンショット/画面録画を求められた場合は添付ファイルに添付して再申請する。

6.Appleから届いたログファイルのシンボル化

■詳細
下記方法でシンボル化手順を実施したところ、空のcrashファイルが作成された。(シンボル化の失敗)
https://qiita.com/orimomo/items/9f88c740ad41cfd25328

■対応方法
Appleから届いたログファイルの拡張子を ".crash" ではなく ".ips" で保存し、そのファイルを開くとシンボル化されている(理由は不明)
⇒自分だけの可能性あり

7.Xcode上でVaridate Appを行なった際に発生するエラー3

■詳細
XcodeでVaridate Appを行ったところ、下記のエラーが発生した。
エラー内容は同じ名前のものがすでにApple上にあるというものです。

App record creation failed due to request containing an attribute already in use. The App Name you entered is already being used. If you have trademark rights to this name and would like it released for your use, submit a claim.

■対応方法
https://goadbulhobbyhappy.com/Error/XCode_AppRecordCreationError.html

8.Xcode上でAchiveを行なった際に発生するエラー1

■詳細
XcodeでAchiveを行ったところ、下記のエラーが発生した。

◯◯ does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '〇〇' for architecture arm64

■対応方法
https://swift.tecc0.com/?p=86

9.Xcodeでのビットコードに関するビルドエラー

■詳細
Xcode上で実機端末にビルドした際、下記のようなエラーが返りビルドに失敗する。

'/Users/XXXXXX/Library/Developer/Xcode/DerivedData/Unity-iPhone-XXXXXX/Build/Products/ReleaseForRunning-iphoneos/AppAuth/AppAuth.framework/AppAuth(OIDAuthorizationService.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/XXXXXX/Library/Developer/Xcode/DerivedData/Unity-iPhone-XXXXXX/Build/Products/ReleaseForRunning-iphoneos/AppAuth/AppAuth.framework/AppAuth' for architecture arm64

■対応方法
下記サイトを参考に対応する

10.iPhoneの「設定」にsandboxの設定が出てこない

■詳細
課金テストをするべくsandboxアカウントの設定を行おうとしたところ、iPhoneの「設定」に出てくるはずのsandbox関連の項目が見当たらず、設定ができない。

■対応方法
開発中のアプリで購入処理を走らせ、SandBox用のアカウントでサインインすれば良いとのこと。
それを1回すれば設定に表示されるようになる。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1