我有一个MacOS应用程序捆绑裸机工作。也就是说,它运行可执行文件,就是这样。即使我有一个我在Finder中可以直观看到的MyApp.icns
文件,图标仍然无法正常工作。并且i18n无法正常工作。
MyApp.app/
Contents/
Info.plist
MacOS/
MyApp # executable
Resources/
MyApp.icns
en.lproj
InfoPlist.strings
jp.lproj
InfoPlist.strings
我从.icns
生成的here:
mkdir MyIcon.iconset
sips -z 16 16 foo.png --out MyIcon.iconset/icon_16x16.png
sips -z 32 32 foo.png --out MyIcon.iconset/[email protected]
sips -z 32 32 foo.png --out MyIcon.iconset/icon_32x32.png
sips -z 64 64 foo.png --out MyIcon.iconset/[email protected]
sips -z 128 128 foo.png --out MyIcon.iconset/icon_128x128.png
sips -z 256 256 foo.png --out MyIcon.iconset/[email protected]
sips -z 256 256 foo.png --out MyIcon.iconset/icon_256x256.png
sips -z 512 512 foo.png --out MyIcon.iconset/[email protected]
sips -z 512 512 foo.png --out MyIcon.iconset/icon_512x512.png
cp Icon1024.png MyIcon.iconset/[email protected]
iconutil -c icns MyIcon.iconset
rm -R MyIcon.iconset
我的Info.plist是这样的:
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleName</key>
<string>MyApp</string>
<key>CFBundleDisplayName</key>
<string>MyApp</string>
<key>CFBundleIdentifier</key>
<string>MyApp</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>MyApp</string>
<key>CFBundleExecutable</key>
<string>this/has/no/effect</string>
<key>CFBundleIconFile</key>
<string>NeitherDoesThis</string>
</dict>
每种语言的InfoPlist.strings如下所示:
CFBundleDisplayName = "Foo";
NSHumanReadableCopyright = "Copyright © 2019 Me.";
要么:
CFBundleDisplayName = "ふ";
NSHumanReadableCopyright = "著作権法 © 2019 目.";
我遇到的问题是:
MyApp.app
相同时才有效,所以MyApp
可执行文件。MyApp.icns
没有在/ Applications文件夹中呈现(这是我到目前为止唯一放置它的地方)。我不确定我是否可以自定义该路径。想知道是否可以验证这些东西,并展示如何测试其他东西。特别:
Skype Blue
。想知道为什么我不能让这个工作。这都不使用XCode。
在Info.plist
缺失/不正确的键/字符串可以影响前两个问题;如果密钥重复,丢失或设置不正确,它肯定会导致功能问题。
NSPrincipalClass
CFBundleInfoDictionaryVersion
CFBundleSupportedPlatforms
CFBundlePackageType
CFBundleExecutable
(这是MacOS文件夹中的二进制文件)
CFBundleLocalizations
(可选)
DTXcode
(可选)
DTPlatform
(可选)
DTSDK
(可选)
DTCompiler
(可选)CFBundleIdentifier
(应采用反向DNS格式)
CFBundleVersion
(重复/不正确)
CFBundleSignature
(不正确)注意:只要您添加并设置了密钥MyApp.app
,应用程序名称MacOS
就不需要与CFBundleExecutable
文件夹中的可执行文件相同。应用程序图标也可以是您想要的任何名称,使其工作的关键是通过包含上面显示的其他CoreFoundation
键正确设置。
一旦你将所有缺失/不正确的密钥排序,你应该得到类似于:
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>MyApp</string>
<key>CFBundleIconFile</key>
<string>MyIcon</string>
<key>CFBundleIdentifier</key>
<string>com.company.MyApp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>MyApp</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>10B61</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>18B71</string>
<key>DTSDKName</key>
<string>macosx10.14</string>
<key>DTXcode</key>
<string>1010</string>
<key>DTXcodeBuild</key>
<string>10B61</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 MyApp. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
*上面的Info.plist
应该适用于您的应用,因为值设置为您在问题中显示的值。
关于i18n
测试 - Internationalization and Localization Guide
部分Testing Your Internationalized App
和Managing Strings Files Yourself
应该是有帮助的。指南中有大量信息;一种尺寸适合所有测试方法通常都不会这样做,你会想找到最适合你的方法。
→Information Property List Key Reference →About Internationalization and Localization