应用数据plist存储方法

iOS-数据存储方式一之plist文件存储 plist文件,实际上也就是xml文件。 iOS开发中,对于一些小型的数据保存,可以用到plist文件存储。 plist存储能存NSArray、NSDictionary等,一般能写出writeToFile:这个方法的对象都可以使用plist存储,存放的路径一般在沙盒的Document文件目录下。plist文件的写入: //获取沙盒Document路径 NSString *curre 阅读详情
应用数据plist存储方法

        OSX或IOS应用数据存储的常用方式:

  1. Plist归档
  2.  Preference(偏好设置)存储
  3. NSKeyedArchiver归档
  4. SQLite3
  5. Core Data

        其中,Preference存储,即是NSUserDefault存储,其实也就是存储成Plist文件。

        本文主要探讨plist存储,自己coding实现存储的过程。基本的方法就是增、删、改、查吧。
        基本功能大概如下:

  1. 添加的方法,使用键值对key-value形式存储.
  2. 取值方法,通过key来获取value.
  3. 删除方法,通过key来删除value.
  4. 修改方法,通过key来修改value.

        主要提供了一些思路,希望能够起到抛砖引玉的作用。最后附上大致的代码:

@interface DataStorage : NSObject

@property (nonatomic,copy) NSString *savePath;

+(DataStorage *)sharedInstance;

//key-value存储
- (void)setItemValue: (id)value
             forKey : (NSString *)key;
//通过key获取value
- (id)itemValueForKey : (NSString *)key;
//通过key删除value
- (void)removeItemValueForKey: (NSString *)key;
//通过一组key删除一组value
- (void)removeItemValueForKeys:(NSArray *)keyArray;
//通过key修改value
- (void)replaceItemValue:(NSString *)newValue forKey:(NSString *)key;
//删除所有的value
- (void)removeAllItemValues;
//获取所存值的个数
- (NSInteger)getItemValueCount;

@end

@implementation DataStorage

@synthesize savePath;

+ (DataStorage *)sharedInstance {
    static DataStorage *_sharedManager = nil;
    static dispatch_once_t oncePredicate;
    dispatch_once(&oncePredicate, ^{
        _sharedManager = [[self alloc] init];
    });
    return _sharedManager;
}

- (id)init {
    self = [super init];
    if (self) {
        NSString *plistPath = [[self documentPath] stringByAppendingString:@"appData.plist"];
        self.savePath = plistPath;
        [self initPlist];
    }
    return self;
}

- (void)setSaveFolderPath:(NSString *)saveFolderPath {
    self.savePath = saveFolderPath;
}

- (void)setItemValue:(id)value
              forKey:(NSString *)key {
    NSMutableDictionary *plistDictionary  = [[NSMutableDictionary alloc]init];
    if ([self isPlistFileExists]) {
        NSMutableDictionary *plistExistDictionary = [self readPlist];
        if (plistExistDictionary != nil) {
            [plistDictionary setDictionary:plistExistDictionary];
        }
    }
    [plistDictionary setValue:value forKey:key];
    [self writeToPlist:plistDictionary];
}

- (id)itemValueForKey:(NSString *)key {
    NSMutableDictionary *dataDictionary = [self readPlist];
    return [dataDictionary objectForKey:key];
}

- (void)removeItemValueForKey:(NSString *)key {
    NSMutableDictionary *dataDictionary = [self readPlist];
    [dataDictionary removeObjectForKey:key];
    [self writeToPlist:dataDictionary];

}

- (void)removeItemValueForKeys:(NSArray *)keyArray {
   NSMutableDictionary *dataDictionary = [self readPlist];
   [dataDictionary removeObjectsForKeys:keyArray];
   [self writeToPlist:dataDictionary];
}

- (void)removeAllItemValues {
    NSMutableDictionary *dataDictionary = [self readPlist];
    [dataDictionary removeAllObjects];
    [self writeToPlist:dataDictionary];
}

- (NSString *)getPlistPath {
    if (self.savePath == nil) {
        NSString *plistPath = [[self documentPath] stringByAppendingString:@"appData.plist"];
        self.savePath = plistPath;
    }
    return  self.savePath;
}

- (BOOL)isPlistFileExists {
    NSString *plistPath =[self getPlistPath];
    NSFileManager *fileManager = [NSFileManager defaultManager];
    if( [fileManager fileExistsAtPath:plistPath]== NO ) {
        NSLog(@"not exist");
        return NO;
    }else{
        NSLog(@"exist");
        return YES;
    }
}

- (void)initPlist {
    NSString *plistPath = [self getPlistPath];
    if (![self isPlistFileExists]) {
        NSFileManager *fileManager = [NSFileManager defaultManager];
        [fileManager createFileAtPath:plistPath contents:nil attributes:nil];
    }
}

-(BOOL)isItemValueExistsForKey:(NSString *)key {
    NSMutableDictionary *dataDictionary = [self readPlist];
    if ([dataDictionary objectForKey:key]) {
        NSLog(@"value not exist");
        return YES;
    }else{
        NSLog(@"value  exist");
        return NO;
    }
}

- (void)deletePlist {
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *plistPath = [self getPlistPath];
    [fileManager removeItemAtPath:plistPath error:nil];
}


- (NSMutableDictionary *)readPlist {
    NSString *plistPath = [self getPlistPath];
    NSData *plistData = [[NSFileManager defaultManager] contentsAtPath:plistPath];
    NSMutableDictionary *resultDictionary = (NSMutableDictionary *)
    [NSPropertyListSerialization propertyListWithData:plistData
                                              options:0
                                               format:nil
                                                error:nil];
    return [resultDictionary mutableCopy];
}

- (void)replaceItemValue:(NSString *)newValue forKey:(NSString *)key {
    NSMutableDictionary *plistDictionary  = [[NSMutableDictionary alloc]init];
    if ([self isPlistFileExists]) {
        NSMutableDictionary *plistExistDictionary = [self readPlist];
        if (plistExistDictionary != nil) {
            [plistExistDictionary removeObjectForKey:key];
            [plistDictionary setDictionary:plistExistDictionary];
        }
    }
    [plistDictionary setValue:newValue forKey:key];
    [self writeToPlist:plistDictionary];
}

- (NSInteger)getItemValueCount {
    NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
    dictionary = [self readPlist];
    return [dictionary count];
}

- (void)writeToPlist:(NSMutableDictionary *)plistDictionary {
    if (plistDictionary != nil) {
        NSString *plistPath = [self getPlistPath];
        NSError *error = nil;
        NSData *plistData = [NSPropertyListSerialization
            dataWithPropertyList:plistDictionary
                          format:NSPropertyListBinaryFormat_v1_0
                         options:0
                           error:&error];
        if ([plistData writeToFile:plistPath atomically:YES]) {
            NSLog(@"write ok!");
        } else {
            NSLog(@"write error!");
        }
    }
}

- (void)generatePlist:dictionary {
    [self writeToPlist:dictionary];
}

 - (NSString *)documentPath{

    NSString *budleIdentifier =[NSString stringWithFormat:@"/%@/",[[NSBundle mainBundle] bundleIdentifier]];

    NSString *path = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES)[0] stringByAppendingString:budleIdentifier];

    NSError *err = nil;

    if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {

        [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&err];

        if (err) {
            NSLog(@"file err:%@",err);
        }
    }

    return path;
}
@end

        

转载请注明出处:http://blog.csdn.net/skynullcode

保姆级教程:手把手带你玩转英飞凌TC397开发板的板载资源(CAN FD、LCD、SD卡) 本文提供英飞凌TC397开发板的全面开发指南,涵盖CAN FD通信、LCD显示、SD卡文件系统和以太网通信等核心功能。通过详细的代码示例和硬件连接说明,帮助开发者快速上手并充分利用开发板的丰富资源,实现高效嵌入式系统开发。 阅读详情

相关推荐

SAP各模块表清单及逻辑关系介绍

分享韩国同行总结的各模块的表清单及逻辑关系,这对ABAP顾问和各模块业务顾问应该非常有用的 物料主数据 SD与MM PS模块 PP模块 QM模块 CO模块 FI模块

weixin_40672823的博客 9622

【iOS】数据持久化(一)之Plist文件、Preference(NSUserDefaults类)

Plist文件(属性列表)是将某些特定的类,通过XML文件的方式保存在目录中。什么是 XML?可扩展标记语言 (XML) 允许您以可共享的方式定义和存储数据。XML 支持计算机系统(如网站、数据库和第三方应用程序)之间的信息交换。预定义的规则简化了在任何网络上以 XML 文件的形式传输数据的过程,接收者可以使用这些规则准确高效地读取数据。 Perference(偏好设置)顾名思义就是专门用来存储系统的偏好配置、用户设置的参数和App的状态等少量信息的,一般不保存其他数据

XY_Mckevince的博客 2201

STM32Cubemx+CanFestival:从零到一的CANopen移植实战

本文详细介绍了如何使用STM32CubeMX和CanFestival实现CANopen协议栈的移植,从开发环境搭建到核心配置步骤,再到调试与问题排查。通过实战经验分享,帮助开发者快速掌握STM32与CANopen的结合应用,提升嵌入式系统开发效率。

weixin_42558093的博客 431

iOS 数据存储:Plist

前言plist文件是iOS数据存储方法的一种,主要用于保存少量的数据在本地。其本质就是文件的读写,获取一个plist的文件路径,以键值对的方式把数据写到plist文件中。plist文件一般会保存在沙盒中,当该应用被删除时,plist文件也会被一同删除。#import @interface LoadViewController : UIViewController@pro

长沙火山 1023

工业界实战:小红书推荐系统中的AB测试策略解析——分层、Holdout与反转实验

本文深入解析了小红书推荐系统在工业界实践中采用的AB测试核心策略。重点阐述了分层实验如何解决多实验并行与干扰问题,Holdout机制如何作为评估黄金标准提供稳定基准,以及反转实验如何作为全量上线后的终极安全网进行风险控制。这些策略共同构成了科学、严谨的线上评估体系,是保障推荐系统迭代效果与决策质量的关键。

transformer2023的博客 483

Simplorer-Maxwell联合仿真速度太慢?我用这3个技巧把仿真时间砍半(附SVPWM周期与步长设置避坑)

本文详细介绍了Simplorer-Maxwell联合仿真性能优化的3个关键技巧,包括仿真步长与周期的科学配置、基于任务调度的加速技术以及模型简化与精度平衡。特别针对SVPWM参数设置提供了避坑指南,帮助工程师在不牺牲精度的情况下将仿真时间缩短50%以上,适用于电机驱动系统开发等场景。

weixin_29189381的博客 476

IOS 数据持久化(一)—— plist 存储

所谓的数据持久化,即数据存取,就是将数据保存到硬盘中,使得在应用程序或机器重启后可以继续访问之前保存的数据。在iOS开发中,有很多数据持久化的方案: XML属性列表(plist)归档; Preference(偏好设置); NSKeyedArchiver归档(NSCoding); SQLite3; Core Data 每个 IOS 应用都有自己的应用沙盒(应用沙盒就是文件系统目录),与其他文件系统隔离

黄飞的博客专栏 1789

全球建筑物提取数据集(免费下载):微软/GlobalMLBuildingFootprints

这个是GitHub上的开源数据集: https://github.com/microsoft/GlobalMLBuildingFootprints 介绍 必应地图正在世界各地发布开放式建筑足迹。我们从 2014 年到 2021 年间的 Bing Maps 图像中检测到了 7.77 亿座建筑物,包括 Maxar 和 Airbus 的图像。数据可在 ODbL 下免费下载和使用。该数据集补充了我们的其他版本。 包括的地区 执照 此数据由 Microsoft 根据Open Dat..

此星光明博客 6313

iOS 数据存储

iOS应用数据存储常用方式: 1>plist文件存储 2>NSUserDefault(设置存储) 3>SQLite3 4>Core Dataplist文件存储plist文件存储是将NSString,NSArray,NSDictionary,NSNumber等类型写到文件中 将字典写入文件中 NSDictionary *plistDic = @{@"arrayA":@[@"1",@"2",@

qq_28828485的博客 267

30分钟上手YOLO26 nano:INT8量化部署到智能相机,推理速度提升43%

微调代码(仅需5行,数据集遵循COCO格式)data="custom_data.yaml", # 数据集配置文件epochs=20, # 少量轮数即可收敛batch=8,imgsz=640model.save("yolov26n_custom.pt") # 保存微调后的模型本文在30分钟内完成了YOLO26 nano的INT8量化与智能相机部署,核心步骤为环境准备→模型获取→ONNX导出→INT8量化→部署推理。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 996

【Bug已解决】[Bug]: ValueError: No user query found in messages QWEN 3.5 27B VLLM 0.16.0 NIGHTLY 解决方案

用 vLLM 0.16.0 nightly 给发聊天请求时,服务端在处理消息时抛ValueError,请求失败。

博客 449

iOS数据存储

iOS数据存储 iOS数据存储方式主要有NSUserDefaults、plist文件、归档、SQLite、CoreData等,不管采用何种存储方式都可以用下图来解释。 下面将主要介绍各种存储方式的使用场景和存储方法。 1、       NSUserDefaults NSUserDefaults为应用偏好设置,是专门用来保存应用程序的配置信息,适合存储轻量级的本地数据。NSUserD

sunshuolei的专栏 681

【WLAN】【调试】再谈如何使用Wireshark解密WiFi数据包——使用TK信息

- 本文介绍了一种wireshark使用TK信息解密空口报文的方式,该方式对是否有关联过程的报文没有要求。

一介草民,只为生活。 1212

ios开发----应用数据存储的常用方法之plist存取方法

ios开发----应用数据存储的常用方法之plist存取方法 时间 2015-06-06 00:15:00  博客园-原创精华区 原文  http://www.cnblogs.com/hukezhu/p/4555861.html 主题 数据存储 iOS开发 [注意]转载时请注明出处 博客园-吃唐僧肉的小悟空http://www.cnblogs.com/hukezhu/

wakice的博客 529

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

iOS 数据持久化之plist

原创Blog,转载请注明出处。 http://blog.csdn.net/hello_hwc?viewmode=list前言:上一篇文章提到了如何使用NSUserDefaults来保存用户偏好信息,本文介绍如何使用plist以及普通文件来保存结构化的数据,通常用Plist来存储不需要结构化查询的数据,结构化查询通常使用CoreData,毕竟建立在数据库上的查询什么的都方便些。希望通过这篇文章,读者

Leo的专栏 2986

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

plist存储(读取/写入)

存数据 (IBAction)save:(id)sender { /* 数据存储是保存在手机里面的 plist文件存储一般都是存取字典和数组,直接写成plist文件,把它存到应用沙盒当 中. 只有在ios当中才有plist存储,它是ios特有的存储方式. 获取沙盒根根路径,每一个应用在手机当中都有一个文件夹,这个方法就是获取当前应用在手机里安装的文件. */ NSString *home

小明同学 1687

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

iOS - OC PList 数据存储

前言 直接将数据写在代码里面,不是一种合理的做法。如果数据经常改,就要经常翻开对应的代码进行修改,造成代码扩展性低。因此,可以考虑将经常变的数据放在文件中进行存储,程序启动后从文件中读取最新的数据。如果要变动数据,直接修改数据文件即可,不用修改代码。一般可以使用属性列表文件存储 NSArray 或者 NSDictionary 之类的数据,这种 “属性列表文件” 的扩展名是 plist,...

rstbfveradsvc 132

plist

在做iOS开发时,经常用到到plist文件,  那plist文件是什么呢? 它全名是:Property List,属性列表文件,它是一种用来存储串行化后的对象的文件。属性列表文件的扩展名为.plist ,因此通常被称为 plist文件。文件是xml格式的。 Plist文件通常用于储存用户设置,也可以用于存储捆绑的信息 我们创建一个项目来学习plist文件的读写。

C语言编程,IOS软件开发,张明生 2376

iOS——plist的创建,数据写入与读取

iOS中plist的创建,数据写入与读取 Documents:应用将数据存储在Documents中,但基于NSuserDefaults的首选项设置除外Library:基于NSUserDefaults的首选项设置存储在Library/Preferences文件夹中 09/02/201 tm...

Watchmen0320的博客 220

使用plist文件存储信息

用户添加或更改的信息用内存来存储是不合适的,因为在用户切换到其他程序的时候可能因为内存不够的原因而关闭我们的程序。 程序关闭后那些信息就丢失了。 因此将信息存在某个地方 ,当程序启动的时候将信息导入,用户修改过后再将信息继续存储则是一种好的方式。 大量的数据由于性能的要求可以存入数据库中,少量的数据存在文件中就可以了。 而iOS则提供了plist这种文件形式来存储少量的信息

wangxiaobupt的专栏 824

接口请求数据 缓存本地 .plist 文件

//奖获取的数组或者字典存入 financeArr 数据数组 1。//本地保存 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); //获取完整路径 NSStri...

dianpaiqiao0548的博客 197

iOS 将网络请求数据转换成plist文件

需求设想: iOS存储方式有很多,我就不一一说明了,现在我只提到我用到的。 现在有个需求是将部分数据存到本地,并且在没有网络的情况下能够查看数据。 根据这个需求,也就是需要做一个数据本地化存储。 那么我们可以想到有呢么几种方式: 1.NSUserDefaults  2.CoreData 3.存到Library目录下(以plist方式存储、用数据库方式存储) 思路解决: NSUse...

赵前的博客 1236

model存储 swift_iOS ~ Swift之数据存储(.plist,NSUserDefaults,NSKeyedArchiver)

最近公司项目中使用了本地存储,所以趁着周六日来整理一下在Swift中的几种数据存储方式。一、plist文件存储存储目录:Documents每次在Xcode中新建一个iOS项目后,都会自己产生一个.plist文件,里面记录项目的一些配置信息。我们也可以自己创建.plist文件来进行数据的存储和读取。.plist文件其实就是一个XML格式的文件,支持的数据类型有NSDictionary、NSArray...

weixin_39895481的博客 841

plist和NSUserdefaults存储

plist l属性列表是一种XML格式的文件,拓展名为plist l如果对象是NSString、NSDictionary、NSArray、NSData、NSNumber等类型,就可以使用writeToFile:atomically:方法直接将对象写到属性列表文件中 获取Documents:(2种方式) 1>利用沙盒根目录拼接”Documents”字符串

u013370845的博客 283

iOS plist 文件的读写

plist 文件全称:Property List. 属性列表文件,它是一种用来存储串行化后的对象的文件。属性列表文件的扩展名为 .plist ,因此通常被称为 plist 文件。文件是 XML 格式的。 plist 文件通常用于储存用户设置,也可以用于存储捆绑的信息。

WriteOnRead 1176

ios plist_iOS属性列表(plist)示例

ios plistThere are many better ways to keep persistent data in our application rather than hardcoding the static texts. Three commonly used ways are NSUserDefaults, CoreData, plist. We’ll discuss and ...

从零开始的教程世界 380
上一篇: OSX下代码压缩文件
下一篇: 基于NSTimer的倒计时
SkyNullCode
博客等级 码龄11年 15粉丝 46原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址