英文:
App Launched from Safari Displays: Do you want to allow this page to open "(null)"?
问题
我正在使用Go/Objective-C编写一个Mac OS应用程序。可以说,我没有使用Xcode,而是手动组装了应用程序包。以下是它的文件系统层次结构:
${APPNAME}.app
Contents
MacOS
${APPNAME}(二进制文件)
Resources
Base.lproj
InfoPlist.strings(文本文件)
Info.plist(文本文件)
应用程序包可以正常启动,应用程序按预期工作。在我的Plist文件中,我有一个CFBundleURLTypes字典,用于定义我的应用程序的URL scheme。
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>${APPNAME}</string>
<key>CFBundleURLSchemes</key>
<array>
<string>zzz</string>
</array>
</dict>
</array>
(注意:${APPNAME}
类似于"MyApp.",它不是Java风格的反向DNS名称字符串。)
当我在Safari中点击使用zzz:// scheme的链接时,我收到一个消息,上面显示:
Do you want to allow this page to open "(null)"?
为什么会这样?我在Info.plist文件和InfoPlist.strings文件中都定义了我的应用程序名称。
InfoPlist.strings文件只包含以下内容:
CFBundleName = "My Wonderful Application"
英文:
I am writing a Mac OS app in Go/Objective-C. Suffice it to say, I am not using Xcode and have assembled the application bundle by hand. 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.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>${APPNAME}</string>
<key>CFBundleURLSchemes</key>
<array>
<string>zzz</string>
</array>
</dict>
</array>
(Note: <code>${APPNAME}</code> is something like "MyApp." It is not a Java-style, reverse DNS name string.)
When I click on a link in Safari that uses the zzz:// scheme, I get a message that says:
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.
The InfoPlist.strings file simply contains this:
CFBundleName = "My Wonderful Application"
答案1
得分: 0
显然存在某种缓存机制。当部署到我们设法获取的另一台从未安装过相关软件的 Mac 系统上时,这个问题就不会发生。
注意:之前的系统在每次测试开始时都会将软件完全从中移除。Finder、Safari或其他一些苹果软件可能秘密地将应用程序名称缓存为"(null)"。
答案:在新的 Mac 机器上安装它,或者完全恢复(没有备份)你正在进行测试的机器。
英文:
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.
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)".
Answer: Install it on a new Mac machine, or completely restore (with no backup) the machine you are testing with.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论