growthbook / growthbook-swift

GrowthBook iOS (Swift) SDK
MIT License
13 stars 19 forks source link

FeaturesViewModel.swift:47 ERROR: Failed load local data #50

Closed mattials closed 6 months ago

mattials commented 8 months ago

After upgrading to the latest version 1.0.47, I have started to experience this error:

[2024-03-11 11:49:48.198] FeaturesViewModel.swift:47 ERROR: Failed load local data

This has caused that when returning certain values of features flags these values are not returned correctly.

vazarkevych commented 8 months ago

Hello @mattials, Thank you for bringing this issue to our attention. We are taking a look to resolve it.

alvarogoj commented 7 months ago

Hello @vazarkevych! Any news about this? Thank you!

alvarogoj commented 7 months ago

Hi @vazarkevych! We detected this issue in version 1.0.47 when working on different iOS applications.

We have just updated the pod to version 1.0.52 and the problem is still there:

[2024-04-22 09:35:07.458] FeaturesViewModel.swift:48 ERROR: Failed load local data
[2024-04-22 09:35:07.459] FeaturesViewModel.swift:48 ERROR: Failed load local data

As a hint, if we deactivate the "Ciphered" option it seems to work:

Captura de pantalla 2024-04-22 a las 9 49 14
vazarkevych commented 7 months ago

Hello @alvarogoj,

Thank you for sending us the detailed information, it will help us reproduce the issue. Could you please tell us which toggles you used: Encrypt SDK payload, Hash secure attributes, Hide experiment/variation names? And when you encounter this issue, does it occur at the start of the app or at a different time? Any detail you provide may be important for us.

alvarogoj commented 7 months ago

Hi @vazarkevych. We have all the toggles active: "Encrypt SDK payload", "Hash secure attributes" and "Hide experiment/variation names". We encounter this problem anytime, right after application launch or after some time. Thank you.

vazarkevych commented 7 months ago

Thank you for the clarification @alvarogoj. I would like to ask about the clearCache function: have you used it, and which directory did you use to save it?

mattials commented 7 months ago

Hello @vazarkevych We are not using the clearCache function, we are migrating from version '1.0.42' to the latest available version '1.0.52', keeping the same configuration(changing to the new init) we get this error.

Old Init 1.0.42:

GrowthBookBuilder(
            url: url,
            encryptionKey: encryptionKey,
            attributes: attributes
        ) { experiment, result in

        } refreshHandler: { result in

        }.initializer()

New init 1.0.52:

GrowthBookBuilder(
            apiHost: apiHost,
            clientKey: clientKey,
            encryptionKey: encryptionKey,
            attributes: attributes,
            trackingCallback: { experiment, experimentResult in

            }).initializer()
vazarkevych commented 7 months ago

Hi @mattials, please try installing our latest release, version 53, and let me know what appears in the console. I'm interested to see if the error persists or if it has been resolved. Please share the output you receive.

mattials commented 6 months ago

Hi @vazarkevych now with the 1.0.53 throws this errors the first time after the update:

[2024-05-06 09:36:50.535] CachingManager.swift:64 ERROR: File doesn't exist [2024-05-06 09:36:50.536] FeaturesViewModel.swift:54 ERROR: Failed load data from local storage or data is empty [2024-05-06 09:36:50.536] CachingManager.swift:64 ERROR: File doesn't exist [2024-05-06 09:36:50.537] FeaturesViewModel.swift:54 ERROR: Failed load data from local storage or data is empty

vazarkevych commented 6 months ago

Hi @mattials, thank you for your reply. We have uploaded the latest release, version 54, and would like to ask you to check the console again in this new release. It will really help us to fix the issue. Thanks in advance.

mattials commented 6 months ago

@vazarkevych thanks for the quick reply, still the same problem the first time after the update with the 'GrowthBook-IOS' pod version, '1.0.54':

[2024-05-07 11:59:01.730] CachingManager.swift:64 ERROR: File doesn't exist [2024-05-07 11:59:01.731] FeaturesViewModel.swift:54 ERROR: Failed load data from local storage or data is empty [2024-05-07 11:59:01.731] FeaturesViewModel.swift:81 ERROR: Failed get api URL [2024-05-07 11:59:01.731] CachingManager.swift:64 ERROR: File doesn't exist [2024-05-07 11:59:01.731] FeaturesViewModel.swift:54 ERROR: Failed load data from local storage or data is empty

vazarkevych commented 6 months ago

Hi, @mattials and thank you for your quick reply as well. I wanted to ask if you see this message only when the app starts, or during the use of the app too, because it's important. Also, if you still have a problem with certain feature flags not returning correctly.

mattials commented 6 months ago

@vazarkevych the error is only displayed when the app starts, and yes when the error is logged it is not possible to access the features flags.

vazarkevych commented 6 months ago

Hi, @mattials. It was unclear whether it happens on the first launch of the app after installation or every time the app is launched.

mattials commented 6 months ago

hi @vazarkevych It happens on the first launch of the app after installation.

vazarkevych commented 6 months ago

Hi, @mattials, the logic is that if the cache is empty, we will make a request and receive features from the backend. Maybe the problem is in the Internet connection when you can't access the feature flags. And when exactly do you try to get features?

mattials commented 6 months ago

Hello, @vazarkevych the App does have internet connection when it tries to access a feature flag, because in the screen where it tries to access that feature flag, in the presentation of that screen, there is a list that rescues from the backend, also before that list we do the login of the application.

In addition it works correctly in the version '1.0.42' but we want to update to not have to use Rosetta.

vazarkevych commented 6 months ago

Hi, @mattials. We have tried different ways to reproduce this issue, but we still can't do it. Are you using a custom directory for the cache?

mattials commented 6 months ago

hi @vazarkevych we are using this init: https://github.com/growthbook/growthbook-swift/issues/50#issuecomment-2079131535

could you try to migrate from 1.0.42 to this latest version?

vazarkevych commented 6 months ago

@mattials we will do that and I will keep you posted.

vazarkevych commented 6 months ago

Hi, @mattials yesterday we attempted to reproduce this issue by migrating from version 1.0.42, but everything seems to be working fine. Could you please send us a screen recording demonstrating how you encounter the issue? Thank you.

mattials commented 6 months ago

hi @vazarkevych, I can give you a screenshot of the log, we reproduce the error when migrating from version 1.0.42 to last version, it always happens to us, I give you my enviroment too:

Xcode Version 15.3 (15E204a) MacOS 14.4.1 (23E224) Tested in iOS 17.2 and 17.4

Captura de pantalla 2024-05-16 a las 8 02 12
vazarkevych commented 6 months ago

Hi @mattials, thank you for providing the information. We will investigate it.

mattials commented 6 months ago

hi @vazarkevych any news?

vazarkevych commented 6 months ago

Hi, @mattials. Can we maybe set up a call with you? It will be the best way to reproduce the issue because we still can't do that.

mattials commented 6 months ago

hi @vazarkevych ok, we can schedule a call, where can I contact you privately?

vazarkevych commented 6 months ago

Hi, @mattials here is a link to choose a convenient meeting time for you: Choose a meeting time

mattials commented 6 months ago

The issue has been solved!!, thank you for your help.