Problem with ZIPspector project (window not displaying)


#1

Hello,
I’m new to this forum and to Mac programming in general.

Whether I build/run the project that I manually create(per books instructions) or build/run the project contained in the downloaded
examples, I’m unable to get a main window to display.

Any suggestions as to why this is occurring?

The second code example in the NTask Chapter, iPing works fine.

NOTE:
I’m running the latest versions of both OS X(10.6.3) and Xcode(3.2.1)

Thanks


#2

Your NSDocument subclass (MyDocument) should have a pointer (called ‘window’) to the window it is going to display. This is set in MyWindow.xib (from the File’s Owner to the window).

If the outlet is not set, no window will appear.


#3

Something else that might be helpful is near the bottom of page 410, right above where the “Asynchronous Reads” section starts. The book says: “(No Untitled document will appear - this is a viewer - you must open an existing .zip file).”

So in other words, you won’t see a window appear, but the application should be running (you should see a dock icon and the title in the menu bar at the top of your screen should change). Once the app is running, select File -> Open, then select a ZIP file from your system. Once you select one, you will see you application’s window pop open.

Good luck!


#4

Read the file open method very carefully. The default method is readFromData:ofType:error,

Aaron is, instead, using
readFromURL:ofType:error

I have been relying on autocomplete quite a bit in the new xCode, and didn’t notice the wrong method being used. The compiler warning hinted at it, but it took me a while to catch on to the switch. The wrong method is, I think, the default templated-in method for a document-based app.