JohanDegraeve / xdripswift

xdrip for iOS, written in Swift
GNU General Public License v3.0
339 stars 337 forks source link

Fix speak readings on iOS 16 #384

Closed stami closed 2 years ago

stami commented 2 years ago

NOTE: Do not merge before testing with speak readings on and waiting until it speaks.

The issue

AVSpeechSynthesizer does not output any sound on iOS 16. iOS 16 is going to be released tomorrow.

Help wanted

I've been using my ugly workaround for this beta period, but I'd like to hear if I'm the only one hitting this bug...

Solution

https://developer.apple.com/forums/thread/712809

It seems that AVSpeechSynthesizer on iOS 16 requires retaining the instance. I tested it working with a separate test app but I'm hitting a wall with xdrip.

If I move the let syn = AVSpeechSynthesizer.init() in BGReadingSpeaker.swift to file level or to the class level (out of the say function) I get Heap buffer overflow from the framework...

Can anyone try that? I'd like to know if my phone is in a funny state or if that's related to the xdripswift project.

187065809-192cf0b6-3e3e-4096-af0c-d8e99bb02257
stami commented 2 years ago

Can someone try this on their device, please? The bug is affecting a lot of people as iOS 16 has been publicly released.

JohanDegraeve commented 2 years ago

Can someone try this on their device, please? The bug is affecting a lot of people as iOS 16 has been publicly released.

I will do today

JohanDegraeve commented 2 years ago

I have the same problem and I'm not able to fix it (except for your workaround I assume which I did not test) Seems to be a known issue https://developer.apple.com/forums/thread/713848

Maybe it's better to wait till Apple has a fix

stami commented 2 years ago

Ok, thanks, good to know.

Yeah.. the workaround is just playing some pre-exported mp3 files so it is not a feasible solution for all speaking features and localizations the app has 😁

paulplant commented 2 years ago

Can this PR be closed now that we have an improved one on the go? #392

stami commented 2 years ago

Sure, let's open a new one when we have a working fix 👍