Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何定制和测试MacOS.app包的可执行路径、主图标和i18n_Macos_Plist_Bundle - Fatal编程技术网

如何定制和测试MacOS.app包的可执行路径、主图标和i18n

如何定制和测试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

我有一个MacOS应用程序包正在运行。也就是说,它运行可执行文件,就是这样。即使我有一个
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
    可执行
  • 图标
    MyApp.icns
    未显示在/Applications文件夹中(这是迄今为止我唯一放置它的地方)。我不确定是否可以自定义该路径
  • 我不知道如何测试i18n是否有效
想知道是否可以验证这些东西,并展示如何测试其他东西。具体而言:

  • 请验证您不能实际自定义可执行文件的路径,它必须与MacOS文件夹中的应用程序同名
  • 验证您必须将图标命名为与应用相同的名称,扩展名为.icns。我不确定这是真的,因为例如Skypes主图标位于Resources/Skype Blue.icns位置,并且他们在Info.plist中说
    Skype Blue
    。想知道为什么我不能让它工作
  • 如何测试i18n的工作原理。不知道我是否可以再次打开应用程序,等等

  • 这一切都没有使用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>