Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.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
Xcode 如何在沙盒macOS应用程序中运行AppleScript for ImageEvent类?_Xcode_Qt_App Store_Sandbox_Entitlements - Fatal编程技术网

Xcode 如何在沙盒macOS应用程序中运行AppleScript for ImageEvent类?

Xcode 如何在沙盒macOS应用程序中运行AppleScript for ImageEvent类?,xcode,qt,app-store,sandbox,entitlements,Xcode,Qt,App Store,Sandbox,Entitlements,我们正在Mac OS X 10.9上使用Qt 5.2.0.Framework为Mac App Store开发一个应用程序 下面是一个简单的AppleScript,它将.PNG图像转换为.jpeg图像 tell application "Image Events" lanuch set theImageRef to POSIX file ":private:var:root:Desktop:1.png" tell theIma

我们正在Mac OS X 10.9上使用Qt 5.2.0.Framework为Mac App Store开发一个应用程序

下面是一个简单的AppleScript,它将.PNG图像转换为.jpeg图像

tell application "Image Events"
    lanuch
    set theImageRef to POSIX file ":private:var:root:Desktop:1.png"
        tell theImageRef
              save in ":private:var:root:Desktop:save.jpeg"
              close
        end tell
end tell
此AppleScript在非沙盒应用程序中工作。它在沙盒应用程序中失败


我的问题是:如何在沙盒应用程序中使用AppleScript?或者有替代方案吗?

有几种替代方案:

  • 命令行
    sips
    (有关可编写脚本的图像处理套件,请参阅
    mansips
  • 使用
    NSImage
    NSBitmapImageRep
    进行Cocoa(请参阅 )
  • 核基础与代码> CGIMAGEFEF <代码>等(见)
  • QT在
    QPixmap
    类中也有类似的功能(请参阅)
在要使用的沙盒应用程序中使用AppleScript。但是,除非您自己编写应用程序,否则您将很难找到支持目标访问组的应用程序。但是为什么要使用AppleScript进行图像处理呢


在授权中使用的捆绑标识是“com.apple.imageevents”

我有一个用于图像的多个apple脚本,它可以将一种格式转换为另一种格式(.png、.pnb、.sd、.tiff、.pdf等),这只能用于使用apple脚本。我不确定运行apple脚本的权限键。在MSExcel文件的情况下,您的上述链接将成功工作。但是我没有获取授权键。请使用运行我的apple脚本的值定义授权键。@anuj您需要将com.apple.imageevents添加到授权中。对于临时异常中的另一项或scripting-targets.This键(com.apple.imageevents)不适用于将图像转换为另一种格式。请参见上面的权限文件屏幕截图。在Console.app中的沙盒冲突中,您会看到什么错误?据我所知,我的apple脚本未加载到NSApplescript对象中。