ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚑️

Home Page:https://capacitorjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: With CapacitorJS Storage does not work with IOS Version "@capacitor/ios": "^6.0.0"

chaklasiyanikunj opened this issue Β· comments

Capacitor Version

Not working with "@capacitor/ios": "^6.0.0"
working with "@capacitor/ios": "^5.7.1",
In Android It's working "@capacitor/android": "^6.0.0",

Other API Details

No response

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

I used the Preferences below :

 async setUser(data: any) {
        await Preferences.set({
            key: 'MyKey',
            value: JSON.stringify(data)
        });
    }

In Version 6.0.0 It's not able to Store the Key

Expected Behavior

Version 6.0.0 should be able to Store the Key
In Version 5.7.1, It's working fine.

Project Reproduction

Angular

Additional Information

Is there any way to change the key assigned to version 6.0.0?

This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed.
Please see the Contributing Guide for how to create a Sample App.
Thanks! Ionitron πŸ’™

Works for me on iOS with CapacitorJS 6:

import { Preferences } from '@capacitor/preferences';

await Preferences.set({
    key: 'MyKey',
    value: JSON.stringify({data: 'Hello'})
});

let p = await Preferences.get({key: 'MyKey'})
console.log('p', JSON.parse(p.value))
% npx cap doctor
πŸ’Š   Capacitor Doctor  πŸ’Š

Latest Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0

Installed Dependencies:

  @capacitor/android: not installed
  @capacitor/cli: 6.0.0
  @capacitor/ios: 6.0.0
  @capacitor/core: 6.0.0

[success] iOS looking great! πŸ‘Œ