Closed PleaseStopAsking closed 3 months ago
Hey Micheal,
thanks for reporting this! My current car doesn't have CarPlay, so I can only test in the CarPlay simulator, which is obviously not a real world test. In the Simulator, it does seem to work reliably, though.
This error is only shown when the ApiHandler cannot be initialized, which should only happen when the credentials are not saved properly. This would also lead to the iPhone app not working, so I guess I'm missing something here.
Did you have plappa open on your iPhone before connecting to your car or did you open it through CarPlay?
I tested a number of times using the below workflows but could never seem to isolate when it occurs.
In all workflows, it appears that the issue is random so far.
It came up again this afternoon but this time, I was able to see errors in the logs.
While these errors are thrown, I can use the app via phone with no issues.
[3/1/2024, 7:37 AM] [AudioBookShelfAPIHandler] Tried to init ABS APIHandler with no valid token in keychain
[3/1/2024, 7:37 AM] [PlaybackStateHandler] Couldnt instantiate APIHandler, not pushing updated playbackstates.
It came up again this afternoon but this time, I was able to see errors in the logs.
That's interesting, I'll have to look into this. Thanks for the update!
While these errors are thrown, I can use the app via phone with no issues.
That's just weird. Did you download the audiobooks you were trying to play? If the ApiHandler is not initialized, plappa shouldn't be able to send any requests to your server. I suspect the error only occurred in the CarPlay app.
That's just weird. Did you download the audiobooks you were trying to play? If the ApiHandler is not initialized, plappa shouldn't be able to send any requests to your server. I suspect the error only occurred in the CarPlay app.
no, nothing is downloaded.
Okay, I've found the issue with this and #1...
plappa uses the on-device keychain to store the token used to authenticate with the server. If the ApiHandler can't obtain that token from keychain, it will fail to initialize.
The reason this happens is that keychain isn't available when the device is locked.
You should be able to reliably reproduce this issue by not looking at your phone before opening plappa via CarPlay. It shouldn't matter whether plappa is open on your device beforehand as the CarPlay delegate spawns its own ApiHandler, which will fail whenever the device is locked (little lock icon above the date on your lockscreen).
I'll have to figure out a way to mitigate this without reducing security significantly (I really don't want to store the login token in UserDefaults...)
I've just pubished update 0.9 (build 19). It contains a fix for the ApiHandler failing to initialize while the device is locked in addition to some additional debug info if keychain operations fail.
I'll still leave this open for now but it should be fixed.
I will test later today and report back.
After countless uses via CarPlay, I have not seen this issue come up again.
After countless uses via CarPlay, I have not seen this issue come up again.
Great to hear! I'll mark this as closed then. If you have any other feedback, feel free to let me know!
Describe the bug When launching plappa via CarPlay, it randomly reports..
When opening the app via iPhone, the CarPlay issue persists. I can still start/stop a book via the phone when this happens however.
Debug logs show no failures or errors.
To Reproduce
Expected behavior CarPlay shows plappa interface
Screenshots
Environment(please complete the following information):
iPhone 14 Pro
iOS 17.3.1
TestFlight v0.9
Audiobookshelf v2.8.0
Additional context I know that CarPlay support is still a WIP but I wanted to log this for knowledge.