如何定制和测试MacOS.app包的可执行路径、主图标和i18n
我有一个MacOS应用程序包正在运行。也就是说,它运行可执行文件,就是这样。即使我有一个如何定制和测试MacOS.app包的可执行路径、主图标和i18n,macos,plist,bundle,Macos,Plist,Bundle,我有一个MacOS应用程序包正在运行。也就是说,它运行可执行文件,就是这样。即使我有一个MyApp.icns文件可以在Finder中直观地看到,图标仍然不起作用。而i18n不起作用 MyApp.app/ Contents/ Info.plist MacOS/ MyApp # executable Resources/ MyApp.icns en.lproj InfoPlist.strings jp.lpr
MyApp.icns
文件可以在Finder中直观地看到,图标仍然不起作用。而i18n不起作用
MyApp.app/
Contents/
Info.plist
MacOS/
MyApp # executable
Resources/
MyApp.icns
en.lproj
InfoPlist.strings
jp.lproj
InfoPlist.strings
.icns
I生成于:
我的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>
CFBundleDisplayName = "Foo";
NSHumanReadableCopyright = "Copyright © 2019 Me.";
或:
我遇到的问题是:
- 我无法指定可执行路径,只有当它的名称与
相同时,它才能工作,因此MyApp.app
可执行MyApp
- 图标
未显示在/Applications文件夹中(这是迄今为止我唯一放置它的地方)。我不确定是否可以自定义该路径MyApp.icns
- 我不知道如何测试i18n是否有效
Skype Blue
。想知道为什么我不能让它工作这一切都没有使用XCode。
Info.plist中的缺少/不正确的键/字符串可能会影响前两个问题;如果密钥重复、丢失或设置不正确,肯定会导致功能问题
缺失
NSPrincipalClass
CbundleInfo字典版本
CbundleSupportedPlatform
CbundlePackageType
CbundleExecutable
(这是MacOS文件夹中的二进制文件)
CbundleLocalizations
(可选)
DTXcode
(可选)
DTPlatform
(可选)
DTSDK
(可选)
DTCompiler
(可选)
不正确
CbundleIdentifier
(应为反向DNS格式)
CbundLeverVersion
(重复/不正确)
CbundleSignature
(不正确)
注意事项:应用程序名MyApp.app
不需要与MacOS
文件夹中的可执行文件相同,只要您添加并设置了键CbundleExecutable
。应用程序图标也可以是您想要的任何名称,使其工作的关键是正确设置上面显示的附加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>
CfBundledDevelopmentRegion
EN
Cbundlexecutable
MyApp
循环流化床锅炉
麦肯
CbundleIdentifier
com.company.MyApp
CbundleInfo字典版本
6
CFBundleName
MyApp
CbundlePackageType
应用
CbundleShortVersionString
1
CbundleSupportedPlatform
这些章节应该会有所帮助。指南中有大量的信息;一刀切的测试方法通常无法做到这一点,因此您需要找到最适合您的方法
→
→
非常感谢你。想知道是否需要NSMainNibFile
。我不使用XCode。不客气!如果你的应用程序没有windows,那么就没有必要了。以下链接中提到的信息突出显示了推荐的关键点:
CFBundleDisplayName = "ふ";
NSHumanReadableCopyright = "著作権法 © 2019 目.";
<?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>