ERROR ITMS-90503 と出てアプリをApp Storeにアップロードできない

フルメッセージとしては以下のようなのが出た。

ERROR ITMS-90503: "Invalid Bundle. You've included the "arm64" value for the UIRequiredDeviceCapabilities key in your Xcode project, indicating that your app may only support 64-bit. Your binary, 'com.nukenin.hogehoge', must only contain the 64-bit architecture slice. Learn more (https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW3)."

以下の動画にUnityでの対策が載っていた
youtu.be

Player Settings の ArchitectureがUniversalになっているところをarm64に設定すると良いらしい。
調べてみると、armv7を使っていたiPhoneは2013年発売のiPhone 5cまでで、それ以降はarm64のようなので、ほぼ問題ないでしょう。


forum.unity.com
↑これをみると、 2019.4.13f1で直るっぽいことが書いてあった。

追記
arm64に設定しても、ビルド中に何故かUniversalに変更されてしまう...
どうも、自分の入れているあるパブリッシャーから提供されたプラグインの中で、

PlayerSettings.SetArchitecture(BuildTargetGroup.iOS, 2);

とされている部分があったのでこれが原因っぽい。

今回は、XCodeで、Required device capabilites からarm64を取り除くことで一応解決できた。

子供のTrasnformをsortする拡張

Trasnformをsortしたいことがしばしばあったので書いてみました。

もっと軽量にできそうだけどざっくり。

public static class TransformExtensions
{
    private class Comparer : IComparer<Transform>
    {
        public Func<Transform, Transform, int> func;

        public Comparer(Func<Transform, Transform, int> func)
        {
            this.func = func;
        }
        
        public int Compare(Transform a, Transform b)
        {
            return this.func(a, b);
        }
    }

    public static void SortChildren(this Transform t, Func<Transform, Transform, int> func)
    {
        Transform[] children = new Transform[t.childCount];
        for (int i = 0; i < children.Length; i++)
        {
            children[i] = t.GetChild(i);
        }
        var comparer = new Comparer(func);
        Array.Sort(children, comparer);
        foreach (var child in children)
        {
            child.SetAsLastSibling();
        }
    }
}

使い方としては、たとえばsortTransformというtransform以下のHogeというコンポーネントのindexでソートする場合、

sortTransform.SortChildren((a, b) => { return a.GetComponent<Hoge>().index - b.GetComponent<Hoge>().index;});

DOTweenのSequenceでSetLoops(-1)しようとしても一回しか再生されない

これはハマった。
警告なり、エラーなり出して欲しい。
代わりにAppendCallbackを使ってその中でTweenするようにするのが定石っぽい。

github.com

このなかの回答でSequenceは固定のVideoClipのようなもので動的なものではないと書いてある。これ、言っている意味がわからなかったけど、おそらくSetLoops()はループが終わる度にもう一度Tweenを追加するような仕組みになっているんだと思われる。

なので固定のVideoClipのようなSequenceでは使えないと。

Unityをアップデートしたら、iOS版バイナリをアップロード時にITMS-90109の警告を頂くようになった

Unityを2018から2019に更新したタイミングからだと思うのだけれど、App Store Connectにバイナリをアップロードすると以下のような警告を頂くようになってしまった。

ITMS-90109: This bundle is invalid - The key UIRequiredDeviceCapabilities in the Info.plist may not contain values that would prevent this application from running on devices that were supported by previous versions.

ネットで調べると、info.plistからUIRequiredDeviceCapabilitiesを削除すると回避できたとのことだったので、ビルドのポストプロセスで行うことに。

using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;

#if UNITY_IOS
using UnityEditor.iOS.Xcode;

public static class XcodePostProcessBuild
{
    [PostProcessBuild]
    public static void OnPostProcessBuild(BuildTarget target, string path)
    {
        var plistPath = Path.Combine(path, "Info.plist");
        var plist = new PlistDocument();
        plist.ReadFromFile(plistPath);

        plist.root.values.Remove("UIRequiredDeviceCapabilities");

        plist.WriteToFile(plistPath);
        
    }
}
#endif

これで、警告が出ないようにできました。

Unity2018からUnity2019にアップデートしたら、Android版ビルド時にKeystore 周りでエラーが出た

あるプロジェクトをUnity2018からUnity2019にアップデートしたら、Android版のビルド時に

Keystore file '/Users/wakepon/projects/2357/Temp/gradleOut/Divide.keystore' not found for signing config 'release'. See the Console for details.

というエラーが出るようになってしまった。

Player Settings -> Publishing SettingsからKeystore Managerを選んでkeystoreファイルを指定し直し、それ以下も全て再度設定しなおしたらビルドが通るようになった。

Galaxy Noteでのみ、しかもタッチペンを使ったときのみ描けなくなるというバグ

私のリリースしているお絵かきアプリのユーザーさんから、タッチペンを使うときだけ絵が描けないという報告を受けました。調べていくと、奇妙な現象でして、

  • 指では描ける
  • タッチペンを使った場合でもボタン等は反応する
  • 自分の手元にあるiPadや他のタブレットでは問題ない

調べてみると、以下のような投稿をForumで見かけました。

https://forum.unity.com/threads/android-pen-not-working.766508/?fbclid=IwAR2on-iHh1uE4cLJLd9Q1QKJfkXfDjCCDRP1arC3r__geryCtpbCVhw9UiE

どうもGalaxy Note特有の現象なようです。

Unity側で対処すべき問題なのかGalaxy Note側の問題なのかは分からないのですが、とにかく不具合なことは確かです。

issuetracker.unity3d.com


こちらを見ると1月中旬に修正が入ったそうですが、自分の使っているUnity2018.4.15fでビルドしたバージョンでは未だに発生するようでした。

仕方がないので先のフォーラムに書いてあったワークアラウンドを試してみたところ解決できました。

ワークアラウンドというのは見えないUIレイヤーを一つ挟んでそこでタッチとタッチポジションを検知するというもの。

ざっくりこういう感じのコンポーネントを作って、このisPointerDownやpointerPositionをInput.GetMouseButton( 0 )やInput.mousePositionの代わりに使うことで解決できました。

2020/3/6 修正
以前のIDragHandlerを使うバージョンだと僅かな移動の場合にポジションが更新されなかったのでpositionは、Input.mousePositionで取ることにして、downしたかどうかだけをOnPointer関数で取得することにしました。

public class UILayer : IPointerDownHandler, IPointerUpHandler {
    public bool isPointerDown;
 
    //------------------------------------------------------------------------------
    public void OnPointerDown(PointerEventData pointerEventData)
    {
        isPointerDown = true;
    }

    //------------------------------------------------------------------------------
    public void OnPointerUp(PointerEventData pointerEventData)
    {
        isPointerDown = false;
    }
}