Skip to content
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

[iOS] Use app groups path to save storage. #126

Closed
djorkaeffalexandre opened this issue Jun 17, 2019 · 14 comments
Closed

[iOS] Use app groups path to save storage. #126

djorkaeffalexandre opened this issue Jun 17, 2019 · 14 comments
Labels
question General question about usage

Comments

@djorkaeffalexandre
Copy link

djorkaeffalexandre commented Jun 17, 2019

Motivation

When you try to create an iOS Extension (Eg: Share Extension, Watch Extension), if you store info on AsyncStorage you do not have access to this. If you have a method to set suite name to storage path you can use folder of app group and use that.

Description

Create a function like

AsyncStorage.setSuite('group.example')

and after that AsyncStorage use the App Group's path on iOS.

New feature implementation

Can you use code like that to select path to save storage:

NSURL * pathUrl = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier: @"group.example"];
@krizzu krizzu added LEGACY question General question about usage labels Jun 17, 2019
@krizzu
Copy link
Member

krizzu commented Jun 17, 2019

Hi @djorkaeffalexandre ,

Would setting a delegate on Async Storage be helpful in your case? With this, you have access from Native Side to stored data via AS.

@krizzu krizzu added LEGACY and removed LEGACY labels Jun 18, 2019
@enahum
Copy link

enahum commented Jun 26, 2019

This would be extremely useful to have, right now the way I go about this is to create a file that I write using the appGroupId so it I can access it from the native side in the Share Extension, so basically I'm duplicating the data.

By having a way to initialize the AsyncStorage with an appGroup I will no longer need to dup the data.

Perhaps something to consider for v2?

@krizzu
Copy link
Member

krizzu commented Jul 4, 2019

@enahum Yup, definitely. Going to put it on the todo. For now, I'm going to close this one.

thanks.

@yannikw23
Copy link

Hi @krizzu ! Any news on when this might be available? Would love to use this feature!

@aanah0
Copy link

aanah0 commented May 28, 2020

Actual for me too

@krizzu
Copy link
Member

krizzu commented May 28, 2020

I'd like to know a real use case here - As far I as know, RN is not targeting watch extensions yet.

@enahum
Copy link

enahum commented May 28, 2020

@krizzu access to data in notification extensions, share extensions, etc...

@thiagobrez
Copy link
Contributor

This would be very useful for acessing data in share extensions indeed

@joonmanji
Copy link
Contributor

joonmanji commented Aug 30, 2020

+1 on this.

the problem i forsee is that setting an appgroup dynamically might have unintended side-effects. i'd imagine that we would want to set appgroup after hydration of the manifest.json file for data migration on existing apps but we would want to set it before hydration after saving data to the new appgroup.

its a little tricky since async-storage is using a file under the hood.

@krizzu
Copy link
Member

krizzu commented Aug 31, 2020

My question would be if we need to do this dynamically or would setting it once do the trick?
If it's the former, we could have a flag set in Info.plist and use it to change storage to app group path.

@gaodeng
Copy link
Contributor

gaodeng commented Sep 22, 2020

@krizzu Can you merge this code in? https:/RZulfikri/async-storage/tree/add/app-group
Here is a related discussion alinz/react-native-share-extension#166

@matanrokach
Copy link

Hey, any news about this one? This would be extremely helpful!!

@arual5
Copy link

arual5 commented May 3, 2023

Hi @krizzu ! :) Any news on when this might be available?
I really need to use this feature since I have been using AS library for a long time and I need to be able to access data in notification extension, widget extension, etc...

I'm sure it would be very useful and helpful to many people!

@phazei
Copy link

phazei commented Sep 24, 2024

This would be a really useful feature, right now due to this limitation we need to implement our own custom file store on iOS, would really like to use this library instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question about usage
Projects
None yet
Development

No branches or pull requests