I need a way to use keychain as a generic mutable dictionary, I've checked a few libraries:
KeychainItemWrapper: looks like one instance of the wrapper is just one key/value pair, as you need to use kSecAttr* for the keys, for a generic dictionary structure, you need to maintain a list of the wrappers, which is not easy.
PDKeychainBindings: this one does not require kSecAttr* as keys, you can you any string, but it does not provide a way to purge all keychain data, you need to know what key's you've used and remove them individually.
Is there any library that uses keychain as a generic mutable dictionary? Most importantly, has the ability to purge all data like removeAllObjects?
Thanks
Just have a single keychain entry and put a JSON string (human readable) or binary plist data (efficient if using NSPropertyListBinaryFormat_v1_0) as its contents.
http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html
https://developer.apple.com/library/ios/#documentation/cocoa/Reference/Foundation/Classes/NSPropertyListSerialization_Class/Reference/Reference.html
Related
I'm testing Orleans out.
I want to store grain-ids for later use. Is there a way to make the ids typesafe? I want to make it impossible to mix ids of differet types of grains.
Or maybe I should store grainreferences instead? Can grainreferences be typesafe?
One of the overrides of GrainFactory.GetGrain have this signature:
IGrain GetGrain(Type grainInterfaceType, long grainPrimaryKey, string keyExtension);
So you can save the type next to the key, and be able to recreate it later in runtime.
I am trying to set values in a nested dictionary - similar to pythonic dict["key1"]["key2"]=value1 in Apple's my shortcut app on IOS 13. I fail even with a simple dict see attached screenshot which should add an element to the dict. The endgame is to modify EXIF metadata via the Metapho app - non-working example attached
I used ttwo approached
use a basic operation to modify dictionary
use prexisting shortcuts to modify dicitonaries as outline on the following Reddit threat Dictionary utilites.
To reproduce you need to download the attached shortcuts - and Dictionary utilties for the examples using those.
I first checked if I can modify a non-nested dict and nonnested dict.
Modifying non-nested dictionary
Using core tools I cannot add a key-value pair to a dictionary.
Minmal non-working exampleas per below.
Modifying non-nested dictionary using Dictionary tools
Minmal working example
Modifying nested dictionary using Dictionary tools
Using the same tools to modify nested dicts does not work.
Minimal non working example
Any help greatly appreciated. Asked same question on ask different
If values of a dictionary are modified the variable needs to be reset:
reset variable
Using this both nested and non-nested dicts can be modified without external tools.
Essentially this is called by value instead of call by reference. If those tools are used still their output needs to overwrite the variable in question.
Regarding modifying the underlying Exif values it is important it is important that again the output imagevariable needs to be written to new file in the photo app.
Mac
I have iOS app that takes data from the server as json and then serializes them into objects of different types. Types can be complicated, can contain subtypes, can inherit, so there is no any limitations. Another thing that makes everything even more complicated is some of types are stored as AnyObject? and only in run time they are being serialized into real types accordingly to the specific rules. Something like that:
class A {
var typeName: String?
var b: AnyObject?
}
Then when it's serialized it can be done something like that:
if let someClass = NSClassFromString(typeName) as? SomeGenericType.Type{
b = someClass.init()
}
Also querying should be done on all the data. Currently I'm trying to store all of them locally, then load into memory and query there from the code. I'm using User defaults, but they have some limitations, also I needed to provide custom coding to make it work, and each time when I add a new field it turned out that I missed something in coding and nothing works. So it's pain.
Ideally I would just do some magic command and all the objects are sent to local storage no matter how complicated they are. The same to extract them from this storage. Also, user change data so I can't just store primary Json. And I don't want to covert objects back to Jason as for it's pain too.
Any suggestions?
If you want to use sqlite then You can store whole object in one row! I means you can create table with 2 columns one is id and second is your dataobject(it's data type should be blob). Then convert your whole object into data. Then store in sqlite table and retrieve it as data then convert it to object when want to use. By this way your object will remains in same format as you asked
Firebase while meant for online synching and storage can also cache everything locally in case you are offline and perform query's against the local cache. It uses JSON.
CouchDB also has a mobile version for iOS.
Both of those are over kill if your dataset is small; you can just store it as a text file and read the JSON back in. See performance characteristics here. The graph is for a 7MB file so if you are significantly less than that your load time may be minimal.
NSKeyedArchiver.archivedData(withRootObject:) is great for storing custom objects as Data objects. The only thing you need to do to be able to use this is to make your custom objects conform to NSCoding. A great example can be found here:
Save custom objects into NSUserDefaults
Once you have the Data version of the object, it can easily be stored in UserDefaults, as a property in CoreData, or even in the app's keychain entries. Depending on your use case, sensitivity of data, and how much data you intend to store, you might want to use any number of storage methods. NSKeyedArchiver.archivedData(withRootObject:) allows you to pretty much use any of them.
I'm trying to define a default value for my Firebase Remote Config setup.
But I'm not using a plist and have no intention to, since I already have everything setup and working well with Strings (via a Struct) for my constants.
With a plist, the syntax is:
remoteConfig.setDefaultsFromPlistFileName("RemoteConfigDefaults")
But, is there a way to define the default value using a String?
In other words, I have this value, which is just a String:
Constants.URLs.FeedFallback = "https://www.mywebsite.com/stuff/"
I just want to pass that in to seDefaults() somehow. Is this possible? What is the syntax?
You probably want to use the FIRRemoteConfig.remoteConfig().setDefaults() method, which allows you to supply an NSDictionary instead of a plist file. (In Swift you'll be using dictionary of type [String: NSObject])
Just load up your dictionary with your keys and constants, and you should be all set.
Right now I am using ArrayCollection. But I want to change that to Set as I want make sure do duplicate values come.
var addressList:ArrayCollection = new ArrayCollection();
One way is I can use Dictionary and store addresses as a key. And I can just use keys to iterate.
But I am looking for Java HashSet like implementation.
You want to download Polygonal Data Structures. The swc contains a HashSet. If you want Java-style template syntax for Flash, you should also check out Haxe.
The AS3 equivalent to HashMap or HashSet is the Dictionary class, and to a lesser extent, the Object class. Object keys are stored as strings, while with Dictionary the keys are objects. You can't have duplicate entries with either. Are you looking for a specific implementation other than that?