Skip to Content
COCOA學習手冊--使用OBJECTIVE-C第三版
book

COCOA學習手冊--使用OBJECTIVE-C第三版

by Paris Buttfield-Addison, Jonathon Manning
June 2013
Intermediate to advanced
360 pages
6h 50m
Chinese
GoTop Information, Inc.
Content preview from COCOA學習手冊--使用OBJECTIVE-C第三版
156
|
第九章
有些檔案在被複製到應用程式包時經過某種處理,例如,
.xib
檔案從它們
XML 原始碼被編譯成可更迅速讀取的二進制格式,還有,在 iOS 上,
PNG 圖像被處理過,好讓裝置的有限 GPU 能夠更容易地載入它們(然
而,這使得它們無法被 Preview 之類的應用程式所開啟)。別以為檔案只
是簡單地被複製到應用程式包裡﹗
使用 NSFileManager
應用程式能夠存取系統上幾乎任何地方的檔案,「幾乎任何地方」取決於你的應用程式
位在何種 OS 上,以及應用程式是否存在於沙箱(sandbox)內。
如〈應用程式沙箱〉(第 68 頁)的討論,沙箱限制你的應用程式的存取範圍。因此,即
使存心不良的程式碼危及你的應用程式,也不能夠存取(例如)使用者不想要它碰觸的
檔案。
預設上,沙箱限制應用程式的私有工作空間,並且令它無法存取任何使用者檔案。要存
取那些檔案,你必須請求系統處理對使用者顯示檔案選取方框的工作,並且在沙箱上開
hole
),以便操作使用者想要讓你的應用程式存取的檔案(並且僅限於那些檔案)。
你的檔案系統介面是
NSFileManager
物件,它讓你列出檔案夾的內容;建立、重新命
名、以及刪除檔案;修改檔案和檔案夾的屬性;通常可以執行 Finder 所做的檔案系統相
關工作。
要存取
NSFileManager
類別,你使用共用管理器物件(shared manager object)︰
NSFileManager* fileManager = [NSFileManager defaultManager]; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

網頁互動式資料視覺化:使用D3

網頁互動式資料視覺化:使用D3

Scott Murray
深入淺出代數

深入淺出代數

Tracey Pilone, Dan Pilone
自然语言处理实战:从入门到项目实践

自然语言处理实战:从入门到项目实践

Sowmya Vajjala, Bodhisattwa Majumder, Anuj Gupta, Harshit Surana

Publisher Resources

ISBN: 9789862768136