react-native-sensitive-info icon indicating copy to clipboard operation
react-native-sensitive-info copied to clipboard

[IOS] Protected data not available yet. Retry operation

Open Miyagee opened this issue 3 years ago • 10 comments

We started to get a lot of Protected data not available yet. Retry operation from our ios users.

It is happening for ios users above 14.6 while the majority of the problems come from ios 15.x. Does anyone know what could be causing the problem? We're on 6.0.0-alpha.9

Miyagee avatar Nov 18 '21 11:11 Miyagee

I have the same problem.. did you find a solution @Miyagee?

BogdanRad avatar Nov 23 '21 16:11 BogdanRad

Not really, we reduced our number of concurrent async operations which reduced the occurrences. But they still occur.

Miyagee avatar Nov 24 '21 13:11 Miyagee

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 24 '21 22:12 stale[bot]

I've suddently started getting this error too, even though I have not updated my codebase

rubytes avatar Mar 08 '22 07:03 rubytes

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 09 '22 07:04 stale[bot]

Any updates about this one ? Getting the same issue for iOS 15.X Thanks for your work guys!

ribamarsantos avatar May 18 '22 16:05 ribamarsantos

I'm also still getting this error. Any updates yes?

rubytes avatar May 19 '22 06:05 rubytes

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 18 '22 20:06 stale[bot]

I'm also getting this error. Any updates?

sofia-bahamonde avatar Jun 27 '22 13:06 sofia-bahamonde

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 12 '22 03:08 stale[bot]

So, any updates? Because I'm still experiencing this issue and I did expect some updates after more than a year to be honest.

ricardodolnl avatar Jan 09 '23 10:01 ricardodolnl

This may help: https://medium.com/@yoav.ziv/userdefaults-value-returns-nil-although-its-shouldn-t-d55ddf832564

Pickleboyonline avatar Jan 11 '23 01:01 Pickleboyonline

Currently facing the same issue and @Pickleboyonline I don't think the post you have suggested is related to this issue. This issue is related to background capability of the app. @ricardodolnl were you able to resolve this?

sourabhdadapure avatar Jan 13 '23 16:01 sourabhdadapure

@sourabhdadapure i found this in the code https://github.com/mCodex/react-native-sensitive-info/blob/495dd7f08c077f5744e56803e45f54787df3dab3/ios/RNSensitiveInfo/RNSensitiveInfo.m#L261 and that made me think of catching the error and just retrying to get the data. It's not the cleanest solution but it does work for now:

let getDataAttempts = 0;

const getUserData = async () => {
  try {
    const refreshToken = await SInfo.getItem('refreshToken', {});
  } catch (e) {
    if (e.code === 'protected_data_unavailable') {
      if (getDataAttempts < 10) {
        // Retry getting item after 300ms for max 10 attempts.
        setTimeout(() => {
          getUserData();
        }, 300);
      } else {
        // Do something after 10 failed attempts, like logging out.
      }

      getDataAttempts++;
    }
  }
};

ricardodolnl avatar Jan 15 '23 12:01 ricardodolnl

Re-pinging this thread to see if there's any update here?

millro04 avatar Aug 15 '23 18:08 millro04