Questions tagged [nsfilewrapper]

On iOS and Mac OS X, the NSFileWrapper class provides access to the attributes and contents of file-system nodes. A file-system node is a file, directory, or symbolic link. Instances of this class are known as file wrappers.

On iOS and Mac OS X, the NSFileWrapper class provides access to the attributes and contents of file-system nodes. A file-system node is a file, directory, or symbolic link. Instances of this class are known as file wrappers.

File wrappers represent a file-system node as an object that can be displayed as an image (and possibly edited in place), saved to the file system, or transmitted to another application.

There are three types of file wrappers:

  • Regular-file file wrapper: Represents a regular file.
  • Directory file wrapper: Represents a directory.
  • Symbolic-link file wrapper: Represents a symbolic link.

A file wrapper has these attributes:

  • Filename. Name of the file-system node the file wrapper represents.
  • file-system attributes. See NSFileManager Class Reference for information on the contents of the attributes dictionary.
  • Regular-file contents. Applicable only to regular-file file wrappers.
  • File wrappers. Applicable only to directory file wrappers.
  • Destination node. Applicable only to symbolic-link file wrappers.
81 questions
28
votes
1 answer

App reporting inaccurate Usage / Storage

One of my apps will, very occasionally, report its Storage (via Settings -> General -> Usage -> Storage) as 4GB when, in reality, the total size of all files in the app's Sandbox (Documents, Library, tmp) averages around 10MB or so. I'm kind of at…
Casey Fleser
  • 5,707
  • 1
  • 32
  • 43
13
votes
1 answer

Export UIDocument with custom file package UTI

I'm trying to export my UIDocument subclass with a UIDocumentPickerViewController. The subclass writes data to a FileWrapper and its UTI conforms to com.apple.package. But the presented document picker shows "Documents in iCloud Drive are not…
Benjamin Cheah
  • 1,401
  • 17
  • 23
13
votes
3 answers

NSFileWrapper, lazy loading and saving

I have an NSDocument based application that uses filewrappers to save and load its data. The document can have all kinds of resources, so I don't want to load everything into memory. I might be doing something fundamentally wrong, but as soon as I…
Bob Vork
  • 2,927
  • 28
  • 32
10
votes
3 answers

Get path for NSFileWrapper

Given an NSFileWrapper object (for a file or directory), is there any way to get the full path for the location of the actual file on the disk? [fileWrapper filename] only returns the file name, not the path, so it isn't what I'm looking for.
Greg
  • 9,068
  • 6
  • 49
  • 91
10
votes
2 answers

UIDocument & NSFileWrapper - large files taking a long time to save, despite incremental changes

I have a UIDocument based app that uses NSFileWrappers to store data. The 'master' file wrapper contains many additional directory file wrappers, each of which represents a different page of the document. When saving a large document for which only…
Stuart
  • 36,683
  • 19
  • 101
  • 139
10
votes
1 answer

Using NSFileWrapper in NSDocument made of various files

I'm making a document-based Cocoa app in which the document is dynamic a collection of files (users can add or remove files). In particular, the Save and Open operations should be as fast as possible. If I understand the documentation correctly, I…
hpique
  • 119,096
  • 131
  • 338
  • 476
9
votes
1 answer

Is UIDocument a suitable strategy for large documents with metadata?

I'm looking into using UIDocument en NSFileWrapper to store 'projects' that contain quite a few large video files and some small text files. There are a few problems that I run into, and I'm starting to wonder if UIDocument is still the right…
Rengers
  • 14,911
  • 1
  • 36
  • 54
9
votes
2 answers

UIDocument & NSFileWrapper - NSFastEnumerationMutationHandler while changing file wrapper during a save

I have a UIDocument based app that uses NSFileWrappers to store data. The 'master' file wrapper contains many additional directory file wrappers, each of which represents a different page of the document. Whenever I make a change to the document…
Stuart
  • 36,683
  • 19
  • 101
  • 139
9
votes
2 answers

NSFileWrapper returns nil, sometimes

I'm using NSFileWrapper for my package document. Sometimes, when I request the data of a file inside the package I get nil. This is how I query the data of a file inside the package: - (NSData*) dataOfFile(NSString*)filename { NSFileWrapper…
hpique
  • 119,096
  • 131
  • 338
  • 476
9
votes
3 answers

iCloud & NSFileWrapper: Showing as 2 different files in Settings

I have an app that uses a UIDocument that is NSFileWrapper based. My file wrapper is a directory named "XXX.cp", with two sub-files "photo.data" and "photo.metadata". It seems to save and load documents fine, however when I go to Settings\Manage…
Ray Wenderlich
  • 480
  • 2
  • 8
7
votes
2 answers

Sharing a plist file using iCloud

I have a relativley simple app which persists data to a plist file located in the documents folder. The data loads into a UITableView at startup. The user can then edit, delete or add records and any changes get saved back to the plist file. Now I…
smithms
  • 113
  • 2
  • 5
7
votes
2 answers

Does NSFileWrapper load everything into memory?

Lets say I have an NSFileWrapper directory. This directory is made up of several levels of directories and files. Some of the files are large. Are all these files loaded into memory, or are they lazily loaded? If they are loaded into memory, are…
Luke
  • 13,678
  • 7
  • 45
  • 79
7
votes
2 answers

Replacing NSFileWrappers

I have a NSFileWrapper directory in which I would like to update a certain FileWrapper. I was wondering what the best way is to do so? So far I've used this code: [self.fileWrapper addRegularFileWithContents:photoData …
n.evermind
  • 11,944
  • 19
  • 78
  • 122
7
votes
1 answer

UIDocument, NSFileWrapper and Images

I have an UIDocument which I'd like to be comprised of (1) a txt file and (2) several jpg images. I put the txt and all the jpgs into a NSFileWrapper. When I load the UIDocument, I need the info in the txt file really quickly, so I load it first and…
n.evermind
  • 11,944
  • 19
  • 78
  • 122
5
votes
1 answer

Getting filename and path from nsfilewrapper / nstextattachment in NSAttributedString

I have a basic NSTextView with rich text and graphics enabled (in IB). What I'd like to get is the path and filename of any images dragged in so I can pass those to another class. I'm new to NSAttributedString but I've got a loop using…
1
2 3 4 5 6