views:

164

answers:

1

This is for some reason really hard to find and solve. Cannot find any documentation on it. I've got a non-document based application which I would like to open all specific file types, but I do not want to use NSDocuments but let my code handle the opening of file and processing of it. I've added the CFBundleTypeExtensions and all, settings to the info.plist.

Now the application will open the filetype but display an error like: "The document xxxx could not be opened. Application cannot open files in the yyyyy format."

+1  A: 

Have you implemented -application:openFile: in an app delegate? If not, your application has no way of knowing how to open some random file in some random format. It's up to you to add that functionality and respond with success or failure.

Joshua Nozzi
Sorry, I meant something else.When a user double clicks on an file extension (configured in CFBundleTypeExtensions) my app should handle the request correctly. But without usage of NSDocument.
Ger Teunis
You said your app will open (I assume when double-clicking the file) but will complain the document couldn't be opened. In a non-document-based app, this requires you to have an object serve as Application delegate and answer to -application:openFile: to do the right thing. Have you done this?
Joshua Nozzi
Ahh, it was really that simple indeed. This is the answer. I was completely looking at the wrong place. Thanks.
Ger Teunis