facebook twitter hatena line email

「Unity/開発環境/iOS」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(自動プラグイン追加する場合)
(xcode26で以下エラーになる場合)
 
(同じ利用者による、間の16版が非表示)
行1: 行1:
 
==自動プラグイン追加する場合==
 
==自動プラグイン追加する場合==
*Assets/PlayServicesResolver/Editor/Dependencies.xmlなどのファイルを作成([[Unity/GoogleMobileSDK/ライブラリ自動読み込み]] [ショートカット])
+
*[[Unity/GoogleMobileSDK/ライブラリ自動読み込み]] [ショートカット] を参考
 +
*Assets/PlayServicesResolver/Editor/Dependencies.xmlなどのファイルを作成
 
*exportしたxcodeプロジェクトを開く
 
*exportしたxcodeプロジェクトを開く
 
*直下にPodfileがあることを確認。
 
*直下にPodfileがあることを確認。
行8: 行9:
 
*プラグインを導入するときは、xcodeにドラッグ&ドロップする。
 
*プラグインを導入するときは、xcodeにドラッグ&ドロップする。
 
*その際に、copy items if neededで、Create groups
 
*その際に、copy items if neededで、Create groups
*add to targetsをUnityFrameworkを選択
+
*add to targetsからUnity-IPhoneのチェックを外し、UnityFrameworkを選択
 +
 
 +
==iOSシミュレーターをDLする方法==
 +
#xcodeのメニューを選択/Preferences/Platforms/+を選択して、
 +
#iOS x.x simulatorを選択してDLする。
 +
 
 +
==iPhoneのシミュレーターが表示されない場合==
 +
Xcode/Targets/Build Settings/Architectureの
 +
*Supported PlatformsをiOSへ
 +
*Architectureをarm64からStandardArchitectureへ
 +
 
 +
==Unity側でビルドでiOSシミュレーターを設定==
 +
Player Settings/Other Settings/TargetSDK/Simulator SDK
 +
 
 +
参考:https://qiita.com/satotin/items/1de9e9d5e69974912bf5
 +
 
 +
==="Job.Worker 6 (25): EXC_BAD_ACCESS (code=2, address=0x167fc1000)"エラーが出る===
 +
謎・・
 +
 
 +
==ビルド時に"Build destination cannot be the same as the project root directory. ==
 +
To avoid project corruption, please create a new folder and use it as the build destination."エラーが出る場合==
 +
プロジェクトと同じdirを、ビルド先に指定してるので、別のdirを指定する。
 +
 
 +
==ビルドしたAssets/Plugins/iOSに追加したプラグインの場所==
 +
Xcodeでは、Libraries/Plugins/iOSの下に置かれる
 +
 
 +
==xcode26で以下エラーになる場合==
 +
エラー詳細
 +
Assertion failed: (it != _dylibToOrdinal.end()), function dylibToOrdinal, file OutputFile.cpp, line 5196.
 +
 
 +
古いリンカである -ld64 や -ld_classicを外す必要がある。
 +
 
 +
参考:https://qiita.com/SHori358Plus/items/81ad368b00d817dcbac3
 +
 
 +
ld_classicをc#で追加してる場合は、そのファイルを、削除する。
 +
 
 +
[[Unity/バージョンアップメモ/unity2022.3.11f1]] [ショートカット]
 +
 
 +
以下のようにsiliconだけで起こる場合は、判定して除去する。
 +
<pre>
 +
using UnityEngine;
 +
using System.Runtime.InteropServices;
 +
 
 +
public class MacArchitecture
 +
{
 +
    public static bool IsMac()
 +
    {
 +
        return Application.platform == RuntimePlatform.OSXEditor ||
 +
              Application.platform == RuntimePlatform.OSXPlayer;
 +
    }
 +
 
 +
    // Apple Silicon CPU
 +
    public static bool IsAppleSiliconCPU()
 +
    {
 +
        if (!IsMac()) return false;
 +
 
 +
        return SystemInfo.processorType.Contains("Apple");
 +
    }
 +
 
 +
    // Armネイティブ実行
 +
    public static bool IsArm64Binary()
 +
    {
 +
        if (!IsMac()) return false;
 +
 
 +
        return RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
 +
    }
 +
 
 +
    // Intel CPU
 +
    public static bool IsIntelCPU()
 +
    {
 +
        if (!IsMac()) return false;
 +
 
 +
        return SystemInfo.processorType.Contains("Intel");
 +
    }
 +
 
 +
    // Rosetta実行
 +
    public static bool IsRosetta()
 +
    {
 +
        if (!IsMac()) return false;
 +
 
 +
        return IsAppleSiliconCPU() &&
 +
              RuntimeInformation.ProcessArchitecture == Architecture.X64;
 +
    }
 +
 
 +
    public static void PrintInfo()
 +
    {
 +
        Debug.Log("processorType: " + SystemInfo.processorType);
 +
        Debug.Log("architecture: " + RuntimeInformation.ProcessArchitecture);
 +
 
 +
        if (IsIntelCPU())
 +
            Debug.Log("Intel Mac");
 +
 
 +
        else if (IsAppleSiliconCPU() && IsArm64Binary())
 +
            Debug.Log("Apple Silicon Native");
 +
 
 +
        else if (IsRosetta())
 +
            Debug.Log("Apple Silicon (Rosetta)");
 +
    }
 +
}
 +
</pre>

2026年3月12日 (木) 00:40時点における最新版

自動プラグイン追加する場合

  • Unity/GoogleMobileSDK/ライブラリ自動読み込み [ショートカット] を参考
  • Assets/PlayServicesResolver/Editor/Dependencies.xmlなどのファイルを作成
  • exportしたxcodeプロジェクトを開く
  • 直下にPodfileがあることを確認。
  • コマンドで"$ pod update"を行い、インストールする。

手動でプラグインを導入したときに、file not foundとなる場合

  • プラグインを導入するときは、xcodeにドラッグ&ドロップする。
  • その際に、copy items if neededで、Create groups
  • add to targetsからUnity-IPhoneのチェックを外し、UnityFrameworkを選択

iOSシミュレーターをDLする方法

  1. xcodeのメニューを選択/Preferences/Platforms/+を選択して、
  2. iOS x.x simulatorを選択してDLする。

iPhoneのシミュレーターが表示されない場合

Xcode/Targets/Build Settings/Architectureの

  • Supported PlatformsをiOSへ
  • Architectureをarm64からStandardArchitectureへ

Unity側でビルドでiOSシミュレーターを設定

Player Settings/Other Settings/TargetSDK/Simulator SDK

参考:https://qiita.com/satotin/items/1de9e9d5e69974912bf5

"Job.Worker 6 (25): EXC_BAD_ACCESS (code=2, address=0x167fc1000)"エラーが出る

謎・・

ビルド時に"Build destination cannot be the same as the project root directory.

To avoid project corruption, please create a new folder and use it as the build destination."エラーが出る場合== プロジェクトと同じdirを、ビルド先に指定してるので、別のdirを指定する。

ビルドしたAssets/Plugins/iOSに追加したプラグインの場所

Xcodeでは、Libraries/Plugins/iOSの下に置かれる

xcode26で以下エラーになる場合

エラー詳細

Assertion failed: (it != _dylibToOrdinal.end()), function dylibToOrdinal, file OutputFile.cpp, line 5196.

古いリンカである -ld64 や -ld_classicを外す必要がある。

参考:https://qiita.com/SHori358Plus/items/81ad368b00d817dcbac3

ld_classicをc#で追加してる場合は、そのファイルを、削除する。

Unity/バージョンアップメモ/unity2022.3.11f1 [ショートカット]

以下のようにsiliconだけで起こる場合は、判定して除去する。

using UnityEngine;
using System.Runtime.InteropServices;

public class MacArchitecture
{
    public static bool IsMac()
    {
        return Application.platform == RuntimePlatform.OSXEditor ||
               Application.platform == RuntimePlatform.OSXPlayer;
    }

    // Apple Silicon CPU
    public static bool IsAppleSiliconCPU()
    {
        if (!IsMac()) return false;

        return SystemInfo.processorType.Contains("Apple");
    }

    // Armネイティブ実行
    public static bool IsArm64Binary()
    {
        if (!IsMac()) return false;

        return RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
    }

    // Intel CPU
    public static bool IsIntelCPU()
    {
        if (!IsMac()) return false;

        return SystemInfo.processorType.Contains("Intel");
    }

    // Rosetta実行
    public static bool IsRosetta()
    {
        if (!IsMac()) return false;

        return IsAppleSiliconCPU() &&
               RuntimeInformation.ProcessArchitecture == Architecture.X64;
    }

    public static void PrintInfo()
    {
        Debug.Log("processorType: " + SystemInfo.processorType);
        Debug.Log("architecture: " + RuntimeInformation.ProcessArchitecture);

        if (IsIntelCPU())
            Debug.Log("Intel Mac");

        else if (IsAppleSiliconCPU() && IsArm64Binary())
            Debug.Log("Apple Silicon Native");

        else if (IsRosetta())
            Debug.Log("Apple Silicon (Rosetta)");
    }
}