4

I'm new to Mac programming. When I open sample projects, I often get 'deprecated' code warnings during a build. I'd like to fix these and get a clean build using XCode 4.

When Apple deprecates something, how do I find out why it was deprecated?

More importantly, how do I find out what is the 'new' correct way to implement the deprecated task?

For example, I'm seeing deprecation warnings for: QTMovieSizeDidChangeNotification, writeWithBackupToFile, documentForFileName, shouldCreateUI, setShowPanels, QTMovieCurrentSizeAttribute, and many others.

Ferruccio
  • 98,941
  • 38
  • 226
  • 299
Brian
  • 101
  • 2

3 Answers3

5

Look up the method in the documentation - they show the deprecated methods and tell you what the preferred methods are.

For example writeWithBackupToFile is clearly marked as deprecated and shows that writeSafelyToURL:ofType:forSaveOperation:error: should be used instead.

Same with shouldCreateUI which shows that either openUntitledDocumentAndDisplay:error: or openDocumentWithContentsOfURL:display:error: should be used instead.

Also, read the other methods in the documentation - you'll find things that do what you need. For example you list QTMovieSizeDidChangeNotification as being deprecated (in QuickTime 7.6.3). Right above it in the documentation you can see QTMovieNaturalSizeDidChangeNotification which has been available since QuickTime 7.6.3). Use that instead.

Abizern
  • 146,289
  • 39
  • 203
  • 257
  • +1 and @Brian: reading the "Release Notes" can also be very helpful, if a bit on the dry side. – jscs May 25 '11 at 02:37
  • @Abizem I've been researching and testing some more. Thanks, all. I've successfully cleaned away half my depreciation warnings. Also, found that QTMovieNaturalSizeDidChangeNotification is not a replacement for QTMovieSizeDidChangeNotification. Likewise QTMovieNaturalSizeAttribute is not a replacement for QTMovieCurrentSizeAttribute. Natural Size refers to the QTMovie's native resolution, while Current Size refer to the resolution at which a QTMovie is being displayed (this may also be the resolution to which the movie is being decoded, which can resize from native). Any ideas finding new way? – Brian May 25 '11 at 15:21
  • I'm not a QuickTime programmer - I was just showing you a way of dealing with deprecated functions. Have you tried asking on the Apple Developer forums, or the QuickTime API mailing list? – Abizern May 25 '11 at 15:30
  • Thanks for your help. You've solved many of my problems! How do I get onto the QuickTime API mailing list? I had tried to find a list of relevant Apple Dev mailing lists, but I appear to be google-challenged. ^_^ Do you know a link to them? – Brian May 25 '11 at 15:50
1

Look for the deprecated things in the documentation. Usually, there's a note that suggests what to use instead.

For example, the documentation for writeWithBackupToFile:ofType:saveOperation: says:

This method is called by action methods to save document contents to a file. (Deprecated in Mac OS X v10.4. Use writeSafelyToURL:ofType:forSaveOperation:error: instead.)

omz
  • 53,243
  • 5
  • 129
  • 141
  • Thank you. I followed your lead. To anyone else watching this, I found great sample code for this in the QTMetadataEditor, from the Apple Developer site. – Brian May 25 '11 at 15:56
0

Search the documentation for that method/function/constant. It should list there what to use instead, or at least bring up a class that obviously has other methods that do something similar.

Alex Wayne
  • 178,991
  • 47
  • 309
  • 337