App Not Saving as .rsmn


#1

For the life of me, I can’t figure out why my app isn’t saving the file as a .rsmn file type. The icon still appears in the Finder as a simple document, and the inspector window in the Finder indicates the file type as Document.

Because of this, I also can’t reload files as new documents. Help? :open_mouth:


#2

Examine the log when you run the app and see if there are some references to UTI problems. I had a similar situation because I made an initial error when setting the UTI. Once there is something written even fixing the error doesn’t seem to solve the problem. I eventually had to remove all UTI references in the app and dig down into the plist itself to make them go away. Once I did that and had the application built and running again, I added the UTI back (without making a mistake) and everything worked well.


#3

My version at the end of page 169 saves files with the extension .mydoc and is able to read these files to give a new window with data from the file.

Now I’m at the end of page 171. On the first run I got the error in the console

2011-12-23 21:07:45.813 RaiseMan[11940:407] This application can’t reopen autosaved dyn.ah62d4rv4ge8048per7vu files.
2011-12-23 21:07:45.815 RaiseMan[11940:407] -[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:] failed during state restoration. Here’s the error:
Error Domain=NSCocoaErrorDomain Code=256 "The autosaved document “Person.mydoc” could not be reopened. " UserInfo=0x10023b4d0 {NSLocalizedDescription=The autosaved document “Person.mydoc” could not be reopened. }

Looks like the new version of the program doesn’t like the old file with the extension .mydoc (mydoc was in the field Extensions, apparently the default extension).


#4

Interesting, I had the same problem. Here’s the error I was seeing, in case someone searches for it:

[quote]2012-01-27 16:36:57.471 RaiseMan[3268:707] -[NSDocumentController fileExtensionsFromType:] is deprecated, and does not work when passed a uniform type identifier (UTI). If the application didn’t invoke it directly then the problem is probably that some other NSDocument or NSDocumentController method is getting confused by a UTI that’s not actually declared anywhere. Maybe it should be declared in the UTExportedTypeDeclarations section of this app’s Info.plist but is not. The alleged UTI in question is “com.bignerdranch.raisemandoc”.
2012-01-27 16:36:57.471 RaiseMan[3268:707] An NSDocumentController returned nil when sent -fileExtensionsFromType:@“com.bignerdranch.raisemandoc”. See the info about new support for UTIs in the Leopard AppKit release notes.
[/quote]

I was able to fix it by ripping the UTI information out and redoing it. Not sure where my error was either. I couldn’t see it. I assume there was something under the hood I missed.


#5

My saved docs appear with no .rsm extension. The application operates as it should, including saving and opening docs. There is no mention of UTI problems in the log. I deleted the UTI in the .plist file and re-entered the UTI information (matches the screen shots in the book), but the results were the same.

On page 170, the book says that the docs should already have the extension that I chose when created I the project. But, the docs lacked the rsm extension that I entered in the new project box.

I am running Xcode 4.2 on OS 10.7.2. I had named my app 10RaiseMan.

Thank you for any clues you might provide.


#6

I had the same issue and couldn’t see what the problem was. I just copied the source code from Chapter 10 of the book download and carried on with Chapter 12 from there. I don’t think the issue is worth worrying about while learning Cocoa; I just want to finish the book!


#7

I had a similar problem – Finder was not displaying the icons I had chosen and the program could not open previously created documents.

I started digging around in the RaiseMan-Info.plist file in Xcode. In the heading “Document Types” and subheading “Document OS Types” item 0 was listed as “???” I entered in the same information as for the UTI (i.e. com.xxxx.raiseman-doc), recompiled and everything worked perfectly. Hope this helps.


#8

I am having the same problem as others on this page. My program worked fine at the end of page 169, but not by the end of page 171. My saved file did not have the rsmn extension, and it could not be opened. I tried all of solutions on this page, but they didn’t work for me. I can’t believe that Xcode is designed so that developers have to tinker with the plist to get a correct build.

What did work for me finally is to download the solutions and exchange the plists file. Then things worked perfectly.

My question is have things changed in Xcode from when the book was written and now? The book give very clear directions, but they don’t seem to work. I am running Xcode 4.3.2.

Thanks in advance for any help.

– Bob Ayres


#9

Just to say, the solution from turpinm worked for me. Click on RaiseMan-Info.plist in the Supporting Files, edit the item Document types:Item 0 (RaiseMan Doc):Document OS Types:Item 0 from ‘???’ to ‘com.bignerdranch.raiseman-doc’ (or presumably whatever you’ve put in as the Identifier in the Build info.

Open works, drag & drop onto the icon works. Didn’t need to change the files.


#10

PeeDee, thanks for your quick reply to my comments. I tried the turpinm suggestion, but it still didn’t work for me. Then I looked at the plist file from the downloaded solutions that works. It has ??? in the same place where turpinm suggests changing to ‘com.bignerdranch.raiseman-doc’. I just don’t understand what is going on. That is why I am thinking something has changed from the time the book was written to today. This is proving to be one of life’s little mysteries.

Thanks again for your help.
– Bob Ayres


#11

I also went from not working to working with turpinm’s fix. Thanks!


#12

I had a similar problem, and ended up having to manually edit the .plist to add “Information Property List/Exported Type UTIs/Item 0/Equivalent Types/public.filename-extension/Item 0/” with a value of “rsmn” after looking at the .plist in the solutions (I just can’t bring myself to wholesale replace things when I am learning… heh).

I did actually start with the com.bignerdranch.raiseman-doc setting, but when things didn’t work I thought that might be part of the problem (because I had used the com.thebrucecarter prefix when creating the project).

Anyway, it seems to work now.


#13

I solved the problem by populating the Extensions field of Exported UTIs (1) with “rsmn” –- the same extension used in Document Types (1).