Mac Sandbox 可寫路徑

為了提高系統(tǒng)安全性,蘋果引入了Sandbox機(jī)制闯睹,要在app store發(fā)布的軟件需符合該機(jī)制戏羽。軟件的讀寫權(quán)限被嚴(yán)格的限制在一定范圍內(nèi),大部分路徑的讀寫權(quán)限需要向用戶請求瞻坝。但是有些數(shù)據(jù)我們需要獲得較高的權(quán)限蛛壳,而且沒必要每次都向用戶申請。

如何解決呢所刀?還好apple給我們留了一個(gè)路徑讓我們自由讀寫衙荐。下面是apple文檔介紹如何操作相應(yīng)目錄

Container Directories and File System Access

When you adopt App Sandbox, your application has access to the following locations:

The app container directory. Upon first launch, the operating system creates a special directory for use by your app—and only by your app—called a container. Each user on a system gets an individual container for your app, within their home directory; your app has unfettered read/write access to the container for the user who ran it.

App group container directories. A sandboxed app can specify an entitlement that gives it access to one or more app group container directories, each of which is shared among all apps with that entitlement.

User-specified files. A sandboxed app (with an appropriate entitlement) automatically obtains access to files in arbitrary locations when those files are explicitly opened by the user or are dragged and dropped onto the application by the user.

Related items. With the appropriate entitlement, your app can access a file with the same name as a user-specified file, but a different extension. This can be used for accessing files that are functionally related (such as a subtitle file associated with a movie) or for saving modified files in a different format (such as re-saving an RTF flat file as an RTFD container after the user added a picture).

Temporary directories, command-line tool directories, and specific world-readable locations. A sandboxed app has varying degrees of access to files in certain other well-defined locations.

These policies are detailed further in the sections that follow.

The app container directory.就是我們獲取的完全權(quán)限。

The app container directory. Upon first launch, the operating system

creates a special directory for use by your app—and only by your

app—called a container. Each user on a system gets an individual

container for your app, within their home directory; your app has

unfettered read/write access to the container for the user who ran it.


下面是kindle的containers路徑

~/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末浮创,一起剝皮案震驚了整個(gè)濱河市忧吟,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌斩披,老刑警劉巖溜族,帶你破解...
    沈念sama閱讀 211,042評(píng)論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異垦沉,居然都是意外死亡煌抒,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 89,996評(píng)論 2 384
  • 文/潘曉璐 我一進(jìn)店門寡壮,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人讹弯,你說我怎么就攤上這事况既。” “怎么了组民?”我有些...
    開封第一講書人閱讀 156,674評(píng)論 0 345
  • 文/不壞的土叔 我叫張陵棒仍,是天一觀的道長。 經(jīng)常有香客問我臭胜,道長莫其,這世上最難降的妖魔是什么癞尚? 我笑而不...
    開封第一講書人閱讀 56,340評(píng)論 1 283
  • 正文 為了忘掉前任,我火速辦了婚禮榜配,結(jié)果婚禮上否纬,老公的妹妹穿的比我還像新娘。我一直安慰自己蛋褥,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,404評(píng)論 5 384
  • 文/花漫 我一把揭開白布睛驳。 她就那樣靜靜地躺著烙心,像睡著了一般。 火紅的嫁衣襯著肌膚如雪乏沸。 梳的紋絲不亂的頭發(fā)上淫茵,一...
    開封第一講書人閱讀 49,749評(píng)論 1 289
  • 那天,我揣著相機(jī)與錄音蹬跃,去河邊找鬼匙瘪。 笑死,一個(gè)胖子當(dāng)著我的面吹牛蝶缀,可吹牛的內(nèi)容都是我干的丹喻。 我是一名探鬼主播,決...
    沈念sama閱讀 38,902評(píng)論 3 405
  • 文/蒼蘭香墨 我猛地睜開眼翁都,長吁一口氣:“原來是場噩夢啊……” “哼碍论!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起柄慰,我...
    開封第一講書人閱讀 37,662評(píng)論 0 266
  • 序言:老撾萬榮一對(duì)情侶失蹤鳍悠,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后坐搔,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體藏研,經(jīng)...
    沈念sama閱讀 44,110評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,451評(píng)論 2 325
  • 正文 我和宋清朗相戀三年概行,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了蠢挡。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 38,577評(píng)論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡占锯,死狀恐怖袒哥,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情消略,我是刑警寧澤堡称,帶...
    沈念sama閱讀 34,258評(píng)論 4 328
  • 正文 年R本政府宣布,位于F島的核電站艺演,受9級(jí)特大地震影響却紧,放射性物質(zhì)發(fā)生泄漏桐臊。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,848評(píng)論 3 312
  • 文/蒙蒙 一晓殊、第九天 我趴在偏房一處隱蔽的房頂上張望断凶。 院中可真熱鬧,春花似錦巫俺、人聲如沸认烁。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,726評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽却嗡。三九已至,卻和暖如春嘹承,著一層夾襖步出監(jiān)牢的瞬間窗价,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,952評(píng)論 1 264
  • 我被黑心中介騙來泰國打工叹卷, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留撼港,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 46,271評(píng)論 2 360
  • 正文 我出身青樓骤竹,卻偏偏與公主長得像帝牡,于是被迫代替她去往敵國和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子瘤载,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,452評(píng)論 2 348

推薦閱讀更多精彩內(nèi)容