• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem Ejecting Discs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem Ejecting Discs


  • Subject: Re: Problem Ejecting Discs
  • From: Shawn Erickson <email@hidden>
  • Date: Fri, 21 Nov 2003 09:09:41 -0800

On Nov 21, 2003, at 2:11 AM, Patrick Machielse wrote:

I have an NSImageView displaying a pdf located on a mounted CD. When I try
to eject the CD using:

[myImageView setImage:nil];
[[NSWorkspace sharedWorkspace] unmountAndEjectDeviceAtPath:@"myPath"];

It fails. Somehow the ImageView keeps the pdf file open on the device,
preventing a successful eject.

In 'lab' conditions, I replaced the NSImageView with a subclass of NSView
which draws an NSImage (home made NSImageView). Now the above code _does_
work. Sadly, in my 'real world' program I couldn't replicate this result.

Someone must have struggled with this before. Please help! Is there some
known 'art' of ejecting removable discs? Can I check beforehand if the
NS(Image)View has a pointer to a file on disc? And what to do if it has?

How do you create the image that is shown in the NSImageView? How is it released? Is it released before you attempt your unmount? Need a little more information so I am going to assume some things...

You could try using NSImage's setDataRetained:(bool) and set it to retain the data.

An alternative is to load the file data into an NSData object and use that object to construct the image.

-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Problem Ejecting Discs
      • From: Patrick Machielse <email@hidden>
    • Re: Problem Ejecting Discs
      • From: Glenn Andreas <email@hidden>
References: 
 >Problem Ejecting Discs (From: Patrick Machielse <email@hidden>)

  • Prev by Date: Re: NSNumber pointerValue
  • Next by Date: dealloc of App Contoller never gets called
  • Previous by thread: Problem Ejecting Discs
  • Next by thread: Re: Problem Ejecting Discs
  • Index(es):
    • Date
    • Thread