简体   繁体   English

从Safari显示器启动的应用程序:是否要允许此页面打开“(空)”?

[英]App Launched from Safari Displays: Do you want to allow this page to open “(null)”?

I am writing a Mac OS app in Go/Objective-C. 我正在用Go / Objective-C编写Mac OS应用程序。 Suffice it to say, I am not using Xcode and have assembled the application bundle by hand. 可以说,我没有使用Xcode,而是手工组装了应用程序捆绑包。 Here is what it's filesystem hierarchy looks like 这是文件系统层次结构的样子

${APPNAME}.app
  Contents
    MacOS
      ${APPNAME} (binary)
  Resources
    Base.lproj
      InfoPlist.strings (text)
  Info.plist (text)

The bundle launches fine. 该捆绑包可以很好地启动。 Application works as expected. 应用程序按预期工作。 I have a CFBundleURLTypes dictionary in my Plist file which defines a URL scheme for my application. 我的Plist文件中有一个CFBundleURLTypes字典,该字典为我的应用程序定义了URL方案。

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>${APPNAME}</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>zzz</string>
        </array>
    </dict>
</array>

(Note: ${APPNAME} is something like "MyApp." It is not a Java-style, reverse DNS name string.) (注意: ${APPNAME}类似于“ MyApp”。它不是Java样式的反向DNS名称字符串。)

When I click on a link in Safari that uses the zzz:// scheme, I get a message that says: 当我单击Safari中使用zzz://方案的链接时,收到一条消息,内容为:

Do you want to allow this page to open "(null)"?

Why is that? 这是为什么? I have defined my application name in both the Info.plist file and in the InfoPlist.strings file. 我已经在Info.plist文件和InfoPlist.strings文件中定义了我的应用程序名称。

The InfoPlist.strings file simply contains this: InfoPlist.strings文件仅包含以下内容:

CFBundleName = "My Wonderful Application"

There apparently was some sort of caching mechanism happening. 显然有某种缓存机制正在发生。 When deployed to another Mac system we managed to procure, which never had the software in question installed on it, this problem did not occur. 当我们设法采购到另一个Mac系统时,从未在其上安装相关软件,就没有发生此问题。

Note: The previous system which behaved erroneously had, at the beginning of each test, the software completely removed from it. 注意:在每次测试开始时,行为不当的先前系统都会从该软件中完全删除该软件。 Finder, Safari or some other Apple software must have secretly cached the app name as "(null)". Finder,Safari或某些其他Apple软件必须已将应用程序名称秘密缓存为“(空)”。

Answer: Install it on a new Mac machine, or completely restore (with no backup) the machine you are testing with. 答案:将其安装在新的Mac机器上,或完全还原(没有备份)要测试的机器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM