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
5
votes
4 answers

Use ZIP-archives to store NSDocument data

I noticed that Apple started using zip archives to replace document packages (folders appearing as a single file in Finder) in the iWork applications. I'm considering doing the same as I keep getting support emails related to my document packages…
Markus Müller-Simhofer
  • 3,391
  • 1
  • 28
  • 32
5
votes
2 answers

Check if two files are the same in Cocoa

How do you efficiently check if two files are the same (have the same data) in Cocoa? Context: I'm writing a program that receives a file as input (input file) and copies it into a directory. If the directory already contains a file with the same…
hpique
  • 119,096
  • 131
  • 338
  • 476
4
votes
3 answers

Should I use NSFileWrappers in UIManagedDocument?

I am trying to store a plist and several binary files (let's say images) as part of an UIManagedDocument. The name of the binary files are an attribute in Core Data and I don't need to enumerate them, just access the right one when showing the…
Jorge Ortiz
  • 1,556
  • 1
  • 16
  • 19
4
votes
1 answer

NSFileWrapper Basics: How to extract components

Sorry if this is obvious, but I'm struggling with how to extract components from a NSFileWrapper and the docs were not particular enlightening. I have two wrappers. One holds a simple txt file. The other one holds pageSettings. PageSettings is an…
n.evermind
  • 11,944
  • 19
  • 78
  • 122
4
votes
0 answers

File rename failing with NSCocoaErrorDomain Code=513 on device

I'm trying to rename a file (a FileWrapper containing a UIDocument subclass) as follows: coordinationQueue.async { var error: NSError? = nil let fileCoordinator = NSFileCoordinator(filePresenter: self) …
Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
4
votes
1 answer

iOS App using iCloud storage is adding .icloud file extension to my documents

In my iOS (swift 3.0) mobile application, the device creating a document to store in iCloud is able to load and manipulate the file again. Once iCloud transfers the file(s) to another device, they are no longer able to open and have a "." prepended…
Bryan M
  • 101
  • 6
4
votes
1 answer

How do I handle NSFileWrapper files sent via email to non iOS platforms?

I am looking at the NSFileWrapper class, that combines many files into one logical file on iOS. (demo) How do other platforms interact with this format? What occurs when this document type is sent over email/http?
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
4
votes
0 answers

Cocoa document incrementally save big package

For the last 2 days I've been trying to make my single-file document into a package, but I can't get it to work. In the documentation it states the preferred way is to use NSFileWrapper. I've tried it but it's just such a unintuitive way of handling…
thomasguenzel
  • 670
  • 7
  • 25
4
votes
0 answers

Using NSDocument for Packages without NSFileWrapper

I want to create a package with multiple directories containing media data (audio and video) which I then load as AVURLAssets. As AVURLAssets are created with an URL, I can't use (as far as I know) NSFileWrapper. The documentation states that…
thomasguenzel
  • 670
  • 7
  • 25
4
votes
1 answer

iOS app with core data, photos & iCloud

I'm developing an app that uses core data (with UIManagedDocument) for storing user-generated data that I would like to sync with iCloud. I also would like to sync photos that the user takes with the camera within the app. I read that it's not a…
themyong
  • 63
  • 3
3
votes
1 answer

Reading Resource Text Files on iPhone

This is mainly an advice question, so any pointers are much appreciated. I have a text file that I would like to draw on when filling UITableViews. I just don't know when I should actually read the file, or even how. Do I use NSFileManager, or…
3
votes
1 answer

Distinguish between a NSFileWrapper and a directory?

I want to make my app filesystem keep metadata about each file in it but also support directory creation on the user side. I've looked at NSFileWrapper but it appears it saves files with metadata as directories. This makes sense, however now how do…
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
3
votes
1 answer

How can I avoid having NSFileWrapper use lots memory when writing the file

I have an app that is using NSFileWrapper to create a backup of the user's data. This backup file contains text and media files (compression is not relevant here). Sometimes these backup files get quite large, over 200 MB in size. When I call…
Mark Suman
  • 10,430
  • 2
  • 27
  • 23
3
votes
1 answer

NSFileWrapper writeToURL: fails with error "file already exists" - how to simply overwrite the existing file?

I'm trying to figure out what's the most efficient way to save a file package using NSFileWrapper. When I'm saving the file wrapper, I don't use atomic writing and hand in the URL of the previous contents. However, the second write always fails with…
Mark
  • 6,647
  • 1
  • 45
  • 88
3
votes
1 answer

Utility like iFinBox and iExplorer for OS X

I want to make a Utility app like iFunBox and iExplorer for Mac OS X where i can retrieve information and files of connected device and display it. Though i have good experience in iPhone Development, I have never developed anything for mac.Can…
Mihir Mehta
  • 13,743
  • 3
  • 64
  • 88