mac os x 10.9下sandbox使用mail更新了写法,标识下(同理别的如iphoto也是)

碰到苹果os方面的问题,如果在google stack overflow等都找不到答案,一定要在苹果自己的developer官网多找找,要注意搜找的关键字,比如这次mail的升级,可以以sandbox mail关键找,就可以找到你所要的答案

Technical Q&A QA1802

Adopting Scripting Targets for Composing Mail

Q:  How do I use Scripting Targets to replace the temporary sandbox entitlement for composing a message in Apple Mail?

A: Temporary sandboxing entitlements are granted on a short-term basis and will be phased out over time. One such temporary entitlement is the ability to script the Apple Mail app to compose messages.

OS X 10.8 (Mountain Lion) introduced the concept of Scripting Targets. This gives the developers of a target app the ability to expose the functionality they want to be scriptable, and provides a mechanism for scripting that target app without the need for temporary entitlements.

Apple Mail adopts Scripting Targets for composing mail. If your app uses a temporary entitlement to script Apple Mail for the purposes of composing messages, you will need to migrate to Scripting Targets.

Specifically, if your app composes messages in Apple Mail using AppleScript, and

  • has a minimum OS of 10.8, and

  • uses the com.apple.security.temporary-exception.apple-events entitlement with a value of com.apple.mail

replace it with the

  • com.apple.security.scripting-targets entitlement

  • with a key of com.apple.mail

  • and an array with a string value of com.apple.mail.compose.

See Listing 1 for an example plist entry.

Listing 1  Using Scripting Targets to compose messages in Apple Mail.

<key>com.apple.security.scripting-targets</key>
<dict>
    <key>com.apple.mail</key>
    <array>
        <string>com.apple.mail.compose</string>
    </array>
</dict>

You will not need to change your AppleScript code.

If your app scripts Mail to do more than compose messages, you can continue using the temporary entitlement. Please file bugs indicating what you're scripting Mail to do, so engineering can investigate potential replacements using Scripting Targets. (You should also include the Scripting Targets entitlement if your app composes messages.)

If your app has a minimum OS earlier than 10.8, you will also need to continue using the temporary entitlement, but will need to modify it to include :before:10.8. You will also need to add the Scripting Targets entitlement for 10.8 and later compatibility. See Listing 2 for the modified temporary entitlement.

Listing 2  Modifying the Apple Events temporary exception for use prior to 10.8.

<key>com.apple.security.temporary-exception.apple-events:before:10.8</key>
    <string>com.apple.mail</string>

For more information, watch Secure Automation Techniques in OS X.



Document Revision History

Date Notes
2013-10-10

New document that shows how to use Scripting Targets for composing Apple Mail messages instead of using temporary sandboxing entitlements.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值