-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RemoteConfig invalid array decoding #9980
Comments
I found a few problems with this issue:
|
@Harryjeffs Thanks for the report. It's possible that this is addressed by the recently merged #8307. We'll need to investigate. |
Thanks for tagging this @paulb777 . I have updated my project to 9.3.0 to include the changes from #8307 however the issue still occurs with the most basic setup (string array). Furthermore, the issue occurs with both the device defaults & the remote response. Unless my setup is grossly wrong but passes the firebase console JSON check. |
@Harryjeffs Thanks for the update. We'll take a deeper look next week. |
@Harryjeffs what's probably going on is you're using a JSON string instead of a plist array... this should work in 9.3.0:
|
@jakekrog Good catch and thanks for the explanation! @Harryjeffs Let us know if that resolves your question. |
Thanks for that @jakekrog. Unfortunately the issue lies with JSON strings (generated via firebase console) Here is a more realistic scenario that I've encountered. The <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>isAppActive</key>
<string>["yes", "no", "maybe"]</string>
<key>onboarding</key>
<string>[{"title":"Lorem ipsum","imageName":"pencil","description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit","advanceButtonTitle":"Next"},{"title":"Lorem ipsum","imageName":"pencil","description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit","advanceButtonTitle":null},{"title":"Lorem ipsum","imageName":"pencil","description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit","advanceButtonTitle":null}]</string>
<key>paywall</key>
<string>{"title":"Upgrade Today!","subtitle":"Start your %d day free trial today","ctaText":"Unlock Now","features":[{"systemImage":"camera","description":"Lorum Ipsum"},{"systemImage":"lock.open.fill","description":"Lorum Ipsum"},{"systemImage":"xmark","description":"Lorum Ipsum"}],"legal":{"title":"More information visit our /n Terms and Conditions","linkSubString":"Terms and Conditions","subStringLink":"https://apple.com"}}</string>
</dict>
</plist> One workaround I tried was converting <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>isAppActive</key>
<string>["yes", "no", "maybe"]</string>
<key>onboarding</key>
<string>{ "titles": [{"title":"Lorem ipsum","imageName":"pencil","description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit","advanceButtonTitle":"Next"},{"title":"Lorem ipsum","imageName":"pencil","description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit","advanceButtonTitle":null},{"title":"Lorem ipsum","imageName":"pencil","description":"Lorem ipsum dolor sit amet, consectetur adipiscing elit","advanceButtonTitle":null}]}</string>
<key>paywall</key>
<string>{"title":"Upgrade Today!","subtitle":"Start your %d day free trial today","ctaText":"Unlock Now","features":[{"systemImage":"camera","description":"Lorum Ipsum"},{"systemImage":"lock.open.fill","description":"Lorum Ipsum"},{"systemImage":"xmark","description":"Lorum Ipsum"}],"legal":{"title":"More information visit our /n Terms and Conditions","linkSubString":"Terms and Conditions","subStringLink":"https://apple.com"}}</string>
</dict>
</plist> The code is the same as the original issue but hopefully, this helps with debugging. |
Thanks for your patience @Harryjeffs. I've reproduced the issue and confirmed that the Codable implementation does not support array and dictionary defaults set by a plist. I'm working on a fix and hope to have a PR up later this week. In the meantime, you can use the non-Codable APIs as a workaround. Thanks for your persistence in helping us understand the issue. |
[REQUIRED] Step 1: Describe your environment
Swift Package Manage
Remote Config
iOS
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
Example XML:
RemoteConfigDefaults.plist
Fetching the data is fine however decoding runs into the following error:
Relevant Code:
The text was updated successfully, but these errors were encountered: