2

I'm debugging an old OPENSTEP (YellowBox) app, written in Objective-C, running on Windows 2000, built with Project Builder. The only easy way I can find to write a string to disk in Obj-C is [NSString writeToFile], a Cocoa/iOS-era method which doesn't seem to have been written yet in the version of OPENSTEP that I'm compiling against (using Project Builder, YellowBox for Windows 1.0, v365).

I'd basically like to write the details of an exception to disk in an exception handler (using an NS_DURING..NS_HANDLER..NS_ENDHANDLER block).

EDIT:

Right now, I'm getting the following warning: 'NSString' does not respond to 'writeToFile:' Is it possible that there's some other cause (missing a #import, etc.)?

Dov
  • 15,530
  • 13
  • 76
  • 177

3 Answers3

1

I'm looking at the version of Yellow Box for Windows included in WebObjects 4.0 (Project Builder v347.3). The signature of the method in question is -writeToFile:atomically:, which is documented on Apple's current developer site.

I think if you had used this method instead of just -writeToFile:, it would work as expected.

AriX
  • 1,647
  • 2
  • 18
  • 24
1

I thought -writeToFile:* was available as of the original OpenStep API. Actually, yes, at least one was (http://docs.sun.com/app/docs/doc/802-2112/6i63mn65q?l=Ja&a=view#05.Classes-243).

In any case, worse comes to worse, you could use the getString methods to fill a malloc()ed buffer then write that to disk.

bbum
  • 162,346
  • 23
  • 271
  • 359
0

If NSString does not respond to writeToFile:, then your choices are to either add that method to the class (your own implementation), or to get the string out and write it to a file (your own implementation). As @bbum indicates, it's not there. (Hi @bbum!)

vy32
  • 28,461
  • 37
  • 122
  • 246
  • I'm sorry, I've moved far beyond this project, and can't test it anymore. I should probably delete the question, since I'll never be able to verify an answer. – Dov Mar 07 '12 at 13:04