---
title: "[ios]persistence 持久化"
author: "119568242"
date: "2012-10-24T18:12:10Z"
tags: []
categories: ["移动开发"]
slug: "ios-persistence"
draft: false
lastmod: "2012-10-24T18:12:10Z"
id: 1704686
url: "https://poolo.iteye.com/blog/1704686"
---

Property List

Archiving Objects

     保存成 arbitrary graphs\[对象映射图]

Storing things in the Filesystem

     Application bundle directory\[不可写，如要修改则丢出来到 其他目录 然后修改 ]

     Documents directory

     Caches directory

     other (使用NSSearchPathDirectory获得)

 

获得这些directory 的URl通过 

-（NSArray \*）URLsForDirectory:(NSSearchPathDiretory)directory inDmains:(NSSearchPathDiretory)domainMask; 

//前者问目标目录，后者经常使用NSDomainMask;

返回数组的原因是这个是从mac下来的，他会返回很多\[比如不同软件包的xx目录] 但是，在ios下 我们 只是用lastObject.

 

获得NSFileManger

alloc init

也有一个NSDefaultFileManger 这个只能在主线程中使用。所以一般都是使用 alloc init一个NSfileManger来使用。

 

 

SQLite

基于C的SQL api

看看就好了  我们通常会使用下面的    Core Data 来进行操作。

 

Core Data

封装好SQLite 的 persistence工具。