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
3
votes
1 answer

Using AudioToolBox to save Wave file to NSFileWrapper

I've used ExtAudioFileCreateWithURL and ExtAudioFileWrite from the AudioToolBox framework to save my samples to a file. But now I need to save it to an NSFileWrapper since I'm now using NSDocument: - (NSFileWrapper *)fileWrapperOfType:(NSString…
3
votes
1 answer

Can We Determine What's Changed in an iCloud file package?

I am attempting to use a iCloud-enabled UIDocument with a directory-based NSFileWrapper (aka File package) to maintain a complex application state. In my app, the user can have many distinct configurations (kind of like cars that have seat…
Mike M
  • 4,358
  • 1
  • 28
  • 48
3
votes
2 answers

How do I send package-type documents as a mail attachment?

I have a package-type document - i.e. it's really a folder, but it uses NSFileWrapper and conforms to com.apple.package to appear as a file - which I want to share by email. I've made an MFMailComposeViewController and I'm trying to work out what…
Simon
  • 25,468
  • 44
  • 152
  • 266
2
votes
1 answer

UIDocument, FileWrapper & Third-Party File Providers

I use document packages in my application (via FileWrapper API) and I am using the UIDocumentBrowserViewController class for document management. The document package basically represents a hierarchy of (text) files and folders. Everything works…
2
votes
0 answers

How to save files to a document package with a custom extension in Swift

I need to bundle multiple files created within my OSX app into a document package with a custom file extension that can be opened later for modification/playback/etc. For example, I want to save the following…
2
votes
0 answers

How to deal with NSFileWrapper and concurrency?

Using NSFileWrapper and UIDocument. File writing happens in: class MyDocument: UIDocument { var wrapper: NSFileWrapper? override internal func contentsForType(typeName: String) throws -> AnyObject { // called by doc.saveToURL if wrapper…
JKaz
  • 765
  • 6
  • 18
2
votes
1 answer

Convert [NSFileWrapper initDirectoryWithFileWrappers] to Swift

I have following Objective-C code: NSFileWrapper* fileWrapper; NSMutableDictionary* wrappers = [NSMutableDictionary dictionary]; ... fileWrapper = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:wrappers]; I tried to convert…
David.Chu.ca
  • 37,408
  • 63
  • 148
  • 190
2
votes
1 answer

Is it possible to search files of particular extension in the entire device?

In my application, i am trying to find all files of particular extension (like .pdf, .txt, etc) that are stored in the device (either downloaded or transferred from system) and want to list them in table View. Is it possible to do so and if it is…
user302326
2
votes
1 answer

Overriding NSDocument's fileWrapperOfType causes "Document could not be saved."

I've got to be missing something simple, but Google is not helping. My file saves and loads fine. (I've overridden dataOfType to get some stuff in it.) Then I override fileWrapperOfType (in preparation for creating a bundle), and I get a "The…
andyvn22
  • 14,696
  • 1
  • 52
  • 74
2
votes
0 answers

UIDocument & NSFileWrapper with many small files crashes due to low memory

I have a custom UIDocument consisting of a file package with many small files (about 3200 text files). The overall size of the document is only ~600KB, but my app crashes each time I attempt to open the document due to low memory. I tracked it down…
Mark
  • 6,647
  • 1
  • 45
  • 88
2
votes
1 answer

Does NSFileWrapper support lazy loading?

I am creating a NSDocument package that contains potentially hundreds of large files, so I don't want to read it all in when opening the document. I've spent some time searching, but I can't find a definitve answer. Most people seem to think that…
Dejal
  • 813
  • 6
  • 18
2
votes
2 answers

NSMetadataQuery does not find NSFileWrapper folder bundles, only files (but they're there)

I have a strange problem which I can't seem to solve on my own. Any help or thought is appreciated. The problem: NSMetadataQuery finds normal files (like test.txt) but no filewrapper bundle (myWrapperDocument.pro) However, NSFileManager finds all…
auco
  • 9,329
  • 4
  • 47
  • 54
2
votes
1 answer

NSFileWrapper fails when from iCloud and works from local directory

I have a problem syncing NSFileWrapper documents with iCloud. I am able to create my wrapper and save it to my ubiquitous container. When I try to read it from the device that created it, it works. When I try to read form another device that got it…
Thomas Castel
  • 553
  • 1
  • 6
  • 11
2
votes
0 answers

What are reasons why one would want to use NSFileWrapper style packages in an iOS application?

If one is not using iCloud, is there any benefit to using NSFileWrapper style packages in an iOS application? It seems that the only benefit to NSFileWrapper is that you can double-click on the package in the Finder to open it. However, on iOS, the…
Streeter
  • 556
  • 4
  • 22
2
votes
1 answer

NSKeyedUnarchiver SIGBUS BUS_ADRALN crash

I unarchive data in a NSFileWrapper with the following method which usually works very well: - (id)decodeObjectFromWrapperWithPreferredFilename:(NSString *)p { NSFileWrapper *wrapper = [self.fileWrapper.fileWrappers objectForKey:p]; if…
n.evermind
  • 11,944
  • 19
  • 78
  • 122