通过 NSSavePanel 保存文件时沙箱上的不稳定行为

问题描述

我的沙盒应用程序中的两个类需要将 NSDictionary 导出为 plist 文件。在功能上,权限/访问设置为读取/写入用户选择的文件。我在 Mojave 上使用 XCode 10.11.1,并为≥10.12 构建。有几个类需要导出文件,两个非常相似,管理NSDictionary。

对于这两个,当用户提示保存时,我打开一个 NSSavePanel 来选择目标文件名和目录。我对我的两个类使用完全相同的代码

<form id="signupForm" action="" method="POST">

  <input type="hidden" name="apikey" value="XXXXXXXXX">

  <!-- Optional: Can be type="hidden" or type="text" for subject -->
  <input type="hidden" name="subject" value="New Submission Form">

  <!-- If javascript,use "window.location.hash" for redirects -->
  <input type="hidden" name="redirect" value="https://web3forms.com/success">

  <!-- Optional: But Recommended: To Prevent SPAM Submission.
       Make sure its hidden by default -->
  <input type="checkBox" name="botcheck" id="" style="display: none;">

  <!-- Google reCaptcha v3: To Prevent SPAM Submission.PRO Plan only -->
  <input type="hidden" name="recaptcha_response" id="recaptchaResponse">

    <div class="form-group">
        <input type="text" name="First Name" class="form-control-input" id="rname" required>
        <label class="label-control" for="rname">Name</label>
    </div>
    <div class="form-group">
        <input type="text" name="Occupation" class="form-control-input" id="roccupation" required>
        <label class="label-control" for="roccupation">Your Role</label>
    </div>
    <div class="form-group">
        <input type="email" name="email" class="form-control-input" id="remail" required>
        <label class="label-control" for="remail">Email</label>
    </div>
    <!-- <div class="form-group checkBox">
        <input type="checkBox" id="rterms" value="Agreed-to-Terms" required>I agree with the website's <a href="privacy.html">Privacy Policy</a> and <a href="terms.html">Terms & Conditions</a>
    </div> -->
    <div class="form-group">
        <button type="submit" class="form-control-submit-button"/>TELL ME MORE</button>
    </div>
</form>

奇怪的是,以这种方式保存总是对使用此代码的一类有效,而对于第二类则不会成功,除了一个不可复制的时间!我在调试器控制台上没有收到任何消息,但我可以在控制台应用程序中看到一条消息:

沙盒:MyApp (1652) deny(1) file-write-create my_file_path.plist

我验证了一切,重置沙箱设置,清理构建文件夹,退出/重新启动 Xcode,甚至多次重新启动计算机。任何的想法?谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...