I am building a viewer application, which needs to accept "any" kind of file as the selected file to view. In fact it even should accept folders, because in that case I want to show information relevant about the folder such as number of files and such.
Now suppose I decided to use the NSDocument based application architecture to do this. How do I make my application accept any kind of file (and not get these [NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:] failed messages?
My NSDocument subclass needs to accept any kind of file
675 Views Asked by robject At
1
There are 1 best solutions below
Related Questions in MACOS
- How do I customize NSOutlineView to have border color?
- Force sublime text to use PATH from the shell value
- Do executable files always open a terminal window on MacOS?
- setting OpenGL version in objective-C
- C std library don't appear to be linked in object file
- Cross compile simple standard C program on Linux for Mac
- How to generate request format for WCF web service method for Mac and iPhone
- Bundle Multiple Xamarin apps in one pkg installer
- How to Handle Command Line Prompt from a Cocoa App
- AVFoundation - Process each image separately
- CMYK NSImage get pixel data
- how i get the mac of ibeacon or BLE
- Set JAVA_HOME on Mac
- Finding active IPv6 interfaces under Mac OS (using Python)
- OSX: Why is my launchd agent running my script twice?
Related Questions in NSDOCUMENT
- Set representedObject on an NSViewController in a document-based OS X application
- Saving High Score Data with Swift
- How do I override -windowTitleForDocumentDisplayName?
- NSWindowController/NSDocument lifecycle (closing)
- How can I set the title of non-main-windows in an NSDocument application?
- Cocoa application hides on deactivate
- NSDocument + How to access saved versions programmatically
- Music convert and how to know if writing are completed
- Detect overwritten file using NSDocument
- Writing to a document's enclosing folder
- NSCoder "only defined abstract class" woes
- encodeRestorableState for unsaved documents
- autosavedContentsFileURL is nil after successful autosaveWithDelegate
- Access IB instantiated NSBox in MyDocument from another class?
- How to properly save a QTMovie after editing using QTKit?
Related Questions in UTI
- How to define Uniforme Type Identifier in plist to add my iOS app option in share action sheet?
- A way to get all declared UTIs in Cocoa (Swift/Obj-C)... and/or, determining UTIs defined by App bundles?
- CFBundleDocumentTypes not working with non-public UTI in iOS app
- UIDocumentInteractionController share via Instagram (and ONLY Instagram)
- How do you get the Finder "Kind" for a file?
- My NSDocument subclass needs to accept any kind of file
- Phonegap / iPad -- UTI's - Doc types... what to do with incoming URL
- Finder doesn't recognize custom UTI
- Can macosx register an UTI with a dot in the extension?
- Register MPEG-4 as Dragged Type using pyobjc on macos
- Other apps paste the HTML rather than the text version of our pasteboard data in iOS 5
- Are dynamic UTIs stable?
- iOS Document/File type associations - wildcard UTI?
- Is there a way to limit the Applications shown in a UIDocumentInteractionController?
- What is the uniform type identifier (UTI) for an SQLite file on iOS?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Based on the discussion: iOS Document/File type associations - wildcard UTI? I managed to get it working (it seems):
Nameproperty topublic.item.Now the application will be able to open any kind of file as its document. One thing to remember is to keep the following (automatically generated during project creation) methods in place. I deleted them, assuming I did not need them, and that created another error:
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outErrorand to be able to have folders as your document, add:
- (BOOL)readFromFileWrapper:(NSFileWrapper *)fileWrapper ofType:(NSString *)typeName error:(NSError **)outErrorIt seems to work for now, any additional remarks are welcome.