2

I would liked to post a queued announcement

I tried using UIAccessibilitySpeechAttributeQueueAnnouncement but I have trouble converting it into an NSAttributedStringKey

Code:

let queueAnnouncementKey = NSAttributedStringKey(rawValue: UIAccessibilitySpeechAttributeQueueAnnouncement)

let announcementString = NSAttributedString(string: "something",
                                            attributes: [queueAnnouncementKey : NSNumber(booleanLiteral: true)])

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, announcementString)

Problem:

  • The announcement is not queued, if there is an on going announcement at that moment, it ignores my announcement

Possible Cause:

  • I think something the way I create NSAttributedString is wrong

  • I think the NSAttributedString has changed from the time this presentation was made, so needed to use rawValue.

  • May be it is because it is not the correct raw value and that is causing it not to work.

Refer:

https://developer.apple.com/videos/play/wwdc2017-215/?time=1627

https://devstreaming-cdn.apple.com/videos/wwdc/2017/215avg3cuo2bu/215/215_whats_new_in_accessibility.pdf?dl=1

user1046037
  • 16,755
  • 12
  • 92
  • 138

1 Answers1

1

Don't worry, your code is correct with your annoucementString.

However, you should read this answer to understand the use cases why it doesn't work as you want because the system takes over when needs be and all the queued announcements are removed then.

XLE_22
  • 5,124
  • 3
  • 21
  • 72