![](/img/trans.png)
[英]Saving attachments from Mail.app through ScriptingBridge (Objective C)
[英]Can't send attachments from draft (Mail.app)
我正在嘗試發送使用Mail.app創建的草稿。
由於草稿沒有發送方法,因此我必須從草稿中獲取所有內容,並使用它創建新的電子郵件。 沒關系,但是...附件沒有通過。
我正在使用這個:
outgoing.content = message.content;
我正在創建的消息是傳出消息,而我正在閱讀的消息是消息。
我嘗試遍歷消息的附件並手動添加它們,但是我總是這樣:
*** -[SBElementArray addObject:]: can't add an object that already exists.
這就是我遍歷它們的方式:
for (int i=0; i<[message.content.attachments count]; i++) {
MailAttachment *anAttachment = [message.content.attachments objectAtIndex:i];
if (![outgoing.content.attachments containsObject:anAttachment]) {
NSLog(@"File Path: %@", anAttachment.fileName);
MailAttachment *newAttachment = anAttachment;
[outgoing.content.attachments addObject:newAttachment];
}
}
值得注意的是,無論如何,文件路徑NSLog總是以(null)出現。
希望在這里有任何幫助。
根據我的研究,在閱讀消息和獲取其內容時,Mail.app的AppleScript / ScriptingBridge API幾乎被破壞了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.