如何在macOS中为沙盒应用启用插件访问?

时间:2017-03-14 07:35:31

标签: objective-c wkwebview skype appstore-sandbox

我正在我的WKWebView中加载skype web但由于沙盒应用中的插件访问限制而没有发生Skype调用。为skype插件提供访问权限的正确方法是什么。任何线索都表示赞赏。

我在沙箱中试过这些钥匙:

Company.Org.PersonManager

1 个答案:

答案 0 :(得分:0)

尝试在plist文件中添加临时例外。

using (new Impersonation("domain.com", "Administrator", "password"))
{
    Directory.CreateDirectory(webFolder.Replace(@"\", "\\"));
    foreach (string dirPath in Directory.GetDirectories(templatePath, "*", SearchOption.AllDirectories))
              Directory.CreateDirectory(dirPath.Replace(templatePath, webFolder));

    foreach (string newPath in Directory.GetFiles(templatePath, "*.*", SearchOption.AllDirectories))
              FCopy(newPath, newPath.Replace(templatePath, webFolder));
 } 


static void FCopy(string source, string destination)
    {
        int array_length = (int)Math.Pow(2, 10);
        byte[] dataArray = new byte[array_length];
        using (FileStream fsread = new FileStream
        (source, FileMode.Open, FileAccess.Read, FileShare.None, array_length))
        {
            using (BinaryReader bwread = new BinaryReader(fsread))
            {
                using (FileStream fswrite = new FileStream
                (destination, FileMode.Create, FileAccess.Write, FileShare.None, array_length))
                {
                    using (BinaryWriter bwwrite = new BinaryWriter(fswrite))
                    {
                        for (; ; )
                        {
                            int read = bwread.Read(dataArray, 0, array_length);
                            if (0 == read)
                                break;
                            bwwrite.Write(dataArray, 0, read);
                        }
                    }
                }
            }
        }
    }

更多信息: https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AppSandboxTemporaryExceptionEntitlements.html

编辑:根据插件的处理方式,您可能需要更改“apple-events”。有关详细信息,请参阅技术说明。