manicakes / react-native-icloudstore Goto Github PK
View Code? Open in Web Editor NEWA drop in replacement for React Native's AsyncStorage API that wraps the iCloud Ubiquitous Key-Value Store.
License: MIT License
A drop in replacement for React Native's AsyncStorage API that wraps the iCloud Ubiquitous Key-Value Store.
License: MIT License
While you use this package, how can we catch the errors that may occur due to storage limitations?
Eg: when the iCloud storage is full
I'm getting this warning:
Module iCloudStorage requires main queue setup since it overrides constantsToExport
but doesn't implement `requiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
react-native: 0.49.3
react-native-icloudstore: 0.9.0
My project is built with the Ignite CLI (Bowser) and my intention is to fully support iCloud sync which should be easy if I can swap out the React Native Community Async Storage project with this one. But it seems that the JavaScript and native code are out of sync. When running .setItem
it throws the following error:
RNICloudStorage.setItem was called with 3 arguments but expects 2 arguments. If you haven't changed this method yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.
I've tried completely uninstalling all packages, removed automatic linking and replaced with manual and nothing seems to fix the error. I'm only passing two arguments as you can see bellow in my code:
export const saveString = async (key: string, value: string): Promise<boolean> => {
try {
await AsyncStorage.setItem(key, value)
return true
} catch {
return false
}
}
Any suggestions?
Hi @manicakes , the current react-native 0.71.1 produces Invariant Violation, about AsyncStorage not anymore on react-native https://reactnative.dev/docs/asyncstorage
Have you any plans on merging #17 ?
Thanks!
blah blah blah
The concept of the library is exactly what i'm looking for.
I've enabled iCloud and key-value storage through XCode but can't help but feel like i'm still missing a piece. Tried also turning on iCloud Documents and CloudKit and still when I try to setItem the data doesn't get set.
const key = "test"
const content = "...some pretty big string...."
await iCloudStorage.setItem(key, content)
const d = await iCloudStorage.getItem(key)
console.log(d)
d
always seems to be undefined. Was hoping someone may know what's going on.
If i figure it out, i'll resolve and add the solution.
Thanks in advance
The docs should mention that you need to enable this in Xcode
To use this you need to sign your app with an apple developer account and set the
com.apple.developer.ubiquity-kvstore-identifier
entitlement in your app’s Entitlements. You can find your app’s entitlements in Xcode, by going to Project Settings -> Capabilities. Enable the iCloud capability and check Key-value storage. You might need to enable iCloud for your App ID too, by going to Certificates, Identifiers & Profiles on developer.apple.com/account.
duplicate interface definition for class rctbridge
So, i see that there is the function of getItem
, but what if user is not logged in to iCloud? Will it throw error when calling getItem
?
Please add typescript definitions to exported files
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.