0

我正在使用AVSpeechSynthesizer()in Swift 为视障用户阅读一些方向和标题说明。

然而,一段时间后,应用程序崩溃:

-[AXSpeechAction retain]: message sent to deallocated instance 0x1c37e2b0.

当然,该类不包含在我的项目中,我什至不知道是谁创建和删除了它。

4

1 回答 1

0

好的,我求助于 UIAccessibilityAnnouncementNotification 来处理可访问性信息,当然,其他人的转弯指示的话语问题仍然存在。这就是我表达功能的方式:

 func announcementFinished(notification:NSNotification){
        activeAnnouncement=false
    }

 func read(text:String, onlyAccessible:Bool){
     println("reading \(text)")
     if UIAccessibilityIsVoiceOverRunning() && !activeAnnouncement{
               UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification,
                text);
            activeAnnouncement=true
        }
        if (!onlyAccessible && !UIAccessibilityIsVoiceOverRunning()){
            utterance=AVSpeechUtterance(string: text)
            speechSynth.speakUtterance(utterance)
            println("alla fine dell'if")
        }
    }
于 2015-08-04T14:11:14.487 回答