Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Saving multiple values or objects

See original GitHub issue

Hi Eddy,

just to be sure this is the right way, I have a user object that I would like to save, maybe not entire object, but most of the fields, so would like to know if there is a way to pass multiple values in one set method or I need to create n calls to set each value separately. The other question is if I send object to set, do you convert it to string or that is needed to be done before setting the value?

right now I’m saving multiple times…

            key: "user_email",
            key: "user_id",
            key: "user_name",
            value: user.first_name


Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

danielgekcommented, Mar 1, 2017

@davorpeic you don’t need to convert so string value can be an object and the key should be a string.

If you want you can create a new object and store only the fields you would like, or a entire object


let objectExample = {
    field: "value"

    key: "user",
    value: {
        first_name: user.first_name
        objectExample: objectExample 
EddyVerbruggencommented, Aug 12, 2017

The problem is the underlying system on iOS (keychain, exposed through the SAMKeychain library) doesn’t allow anything other than strings. Android allows any type, but that’s the reason the TS definition specs string.

I will add an example for stringify and parse to the readme 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storing multiple values from the same object in an Array
Save this question. Show activity on this post. I am trying to create an Array with all these values form the Detail Class....
Read more >
Storing Multiple Values in Lists — Lesson 4 - YouTube
In this video lesson we explain what a for loop does, show how to correctly write for loops to repeat simple calculations, ...
Read more >
Storing Multiple Values in Lists – Programming with Python
In Python, a list is a way to store multiple values together. In this episode, we will learn how to store multiple values...
Read more >
Saving multiple values to one Datastore? - DevForum | Roblox
A table is container that can store multiple values, but you can't store objects(Instances). Also, you will have to make your table readable ......
Read more >
Storing multiple values in one State - DEV Community ‍ ‍
We will learn how we can store multiple values in single state using useState hook in functional component. demo. Step 1: import useState...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found