【发布时间】:2018-03-29 01:29:25
【问题描述】:
我在处理一些 AppleScript ObjC 代码时遇到了一些问题。问题似乎出在我初始化 AVMIDIPlayer 对象时(第三行重复)。它返回 -1 错误 (AVAudioEngineManualRenderingStatusError)。然后下一行失败,因为 Nil 对象没有任何方法。
以下是相关位:
property NSURL : a reference to current application's NSURL
property AVMIDIPlayer : a reference to current application's AVMIDIPlayer
on open (filelist)
repeat with each_item in filelist
set myfile to quoted form of POSIX path of each_item as string
set myMIDIFile to (NSURL's fileURLWithPath:myfile)
set {myMIDIPlayer, theError} to (AVMIDIPlayer's alloc()'s initWithContentsOfURL:myMIDIFile soundBankURL:none |error|:(reference))
myMIDIPlayer's prepareToPlay()
myMIDIPlayer's play(myHandler)
【问题讨论】:
标签: applescript applescript-objc