macOS 播放器:适用于 IL2CPP 的 C++ 源代码插件
Apple TV

将应用程序提交到 Mac App Store

本页面介绍将应用程序提交到 Mac App Store 的过程。

首先,需要确保在密钥链中安装了正确的配置文件:“3rd Party Mac Developer Application”和“3rd Party Mac Developer Installer”配置文件。请参阅 Apple 开发者文档中的维护签名身份和证书 (Maintaining Your Signing Identities and Certificates) 部分以了解如何执行此操作。

Go to Edit > Project Settings and select the Player category. Select the Standalone target, expand the Other Settings section and navigate to Mac App Store Options.

Unity automatically applies these settings to your app’s info.plist file as CF keys (see Apple’s developer documentation on Core Foundation Keys to learn more).

Mac App Store Options
Mac App Store Options
属性 功能
Bundle Identifier Enter the Bundle Identifier of your iTunesConnect App. This appears as CFBundleIdentifier in the associated info.plist file.

See the Apple developer documentation on CFBundleIdentifier to learn more.
Build Enter the build number for this version of your app. This appears as CFBundleVersion in the associated info.plist file.

See the Apple developer documentation on CFBundleVersion to learn more.
Category Enter the string corresponding to the app’s type. The App Store uses this string to determine the appropriate categorization for the app. By default, this is set to the game category, public.app-category.games.

See the Apple developer documentation on LSApplicationCategoryType to see the list of category types available.
Mac App Store Validation 通过启用此属性,可确保只有当应用程序包含来自 Mac App Store 的有效收据时才会运行。这样可以防止用户不在购买游戏的设备上而在另一台设备上运行游戏。仅当您已实施自己的收据验证时,才应禁用此设置。

Enable the Mac App Store Validation setting, then build your app (File > Build Settings… > Build).

接下来,需要创建一个 GAMENAME.entitlements 文件,并将其保存在任意位置。为此,最简单的方法是创建一个空的 Mac 应用程序。要执行此操作,请打开 Xcode,使用 macOS 模板创建一个新项目,转到 Capabilities 栏,并启用 App Sandbox。这样就会自动生成基本的 .entitlements 文件。


 <?xml version="1.0" encoding="UTF-8"?>

  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

  <plist version="1.0">

  <dict>

  <key>com.apple.security.app-sandbox</key> <true/>

  </dict>

  </plist>

在 Xcode(或任意文本编辑器)中打开 info.plist 文件,并添加以下键:

<key>LSApplicationCategoryType</key>

<string>{VALID APP CATEGORY, e.g.: public.app-category.kids-games }</string>

<key>CFBundleSignature</key>

<string>{4 LETTER CREATOR CODE, e. g.:  GMAD }</string>

如果使用的是 Xcode 8.0+,还需要将以下字段添加到 info.plist 文件中:

<key>CFBundleSupportedPlatforms</key>

    <array>
    
        <string>MacOSX</string>
        
    </array> 

接下来,修复 .app 中所有内容的读取权限。要执行此操作,请将以下内容添加到 macOS 终端:

 chmod -R a+xr "/path/to/GAMENAME.app"

使用先前创建的 .entitlements 对 .App 进行签名。要执行此操作,请将以下内容添加到 macOS 终端:

 codesign -f --deep -s '3rd Party Mac Developer Application: DEVELOPER NAME' --entitlements "GAMENAME.entitlements" "/AppPath/GAMENAME.app"

构建安装程序/pkg。要执行此操作,请将以下内容添加到 macOS 终端:

 productbuild --component GAMENAME.app /Applications --sign "3rd Party Mac Developer Installer: DEVELOPER NAME" GAMENAME.pkg

最后,使用 Xcode ApplicationLoader 提交应用程序。

Custom Icons

By default, Unity downsizes the icon image that you specified on the Icon panel of the Player settings (open Edit > Project Settings, then select the Player category) to generate an .icns file. This defines how your app’s icon appears in the macOS Finder and in the OS dock. However, you can replace it with a custom icon set if you want to.

  • 创建一个文件夹并将其命名为 UnityPlayer.iconset(或者是在 info.plistCFBundleIconFile/Icon File 字段中设置的任何名称),然后在其中放入以下名称的图像。请注意,此文件夹必须具有 .iconset 扩展名。
    icon_16x16.png

        icon_16x16@2x.png

        icon_32x32.png

        icon_32x32@2x.png

        icon_128x128.png

        icon_128x128@2x.png

        icon_256x256.png

        icon_256x256@2x.png

        icon_512x512.png

        icon_512x512@2x.png

确保 @2x.png 图像的大小是文件名中规定大小的两倍。例如,图像 512x512@2x.png 为 1024x1024 的图像。从 macOS 终端,导航到 .iconset 目录所在的目录,然后输入以下命令:

    iconutil -c icns UnityPlayer.iconset

最后,右键单击 .app 文件,然后选择 __Show Contents__,并将 iconset.icns 替换为先前创建的文件。


macOS 播放器:适用于 IL2CPP 的 C++ 源代码插件
Apple TV