What's the best way to store and retrieve multi-dimensional NSMutableArrays?

前端 未结 3 810
挽巷
挽巷 2021-02-10 04:45

I\'m storing a bunch of data in a .plist file (in the application documents folder), and it\'s structured like this:

Dictionary {
    \"description\" = \"String          


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-10 05:13

    What you want is a deep mutable copy. Cocoa doesn't include a way to do it. A few people have written such deep-copy implementations before (example).

    However, Core Foundation includes the CFPropertyList API, which does have support both for creating deep mutable copies of property list objects as well as reading in property lists from disk as mutable datatypes. (And, of course, Core Foundation's property list types are toll-free bridged with Cocoa's, meaning you don't have to convert between them — an NSArray is a CFArray and vice-versa.)

提交回复
热议问题