Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 821989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:44:01+00:00 2026-05-15T02:44:01+00:00

I had a bookmark which described the process on how to do this –

  • 0

I had a bookmark which described the process on how to do this – finding the name of a mounted CD in OS X – but I deleted the bookmark when I reformatted my Mac. 😛

Reading up on the subject, this is what I think might work. Basically, I need to verify if a particular CD is mounted before continuing in the application

  1. Access NSWorkspace
  2. Perform ‘checkForRemovableMedia’
  3. Grab array of mounted media paths from ‘mountedRemoveableMedia’
  4. Run through array of mounted media paths to find one containing name of targeted disc

Anyway, this is what I’ve came up with as a possible solution. Anyone else have any other ideas/knowledge in this area in Cocoa? Suggestions 🙂

EDIT:
I made this code below, but isn’t working. It creates an NSCFArray which contains NSCFStrings, which I read up and shouldn’t be doing.

 NSArray *mountedItems = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];

 int count = [mountedItems count];
 int i = 0;

    for (i = 0; i < count; i++) {
         //line is not printing.  contains NSCFArray and NSCFStrings
            [NSLog print:[[mountedItems objectAtIndex:i] stringValue]];
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:44:01+00:00Added an answer on May 15, 2026 at 2:44 am

    OK, so I’m an idiot.

    [[NSWorkspace sharedWorkspace] checkForRemovableMedia];
    NSArray *mountedItems = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];
    
    NSUInteger count = [mountedItems count];
    NSUInteger i = 0;
    for (i = 0; i < count; i++) {
        NSString *tempString = [mountedItems objectAtIndex:i];
        NSLog(@"%@",tempString);
    }
    

    I was not only using NSLog wrong, but completely didn’t even realize that perhaps calling ‘stringValue’ on a string is redundant. And also what caused the code to break. 😛

    This works now; I also added ‘checkForRemovableMedia’ as an extra precaution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to process this form with ajax, but it's not entirely clear
had a look for a guide on this but couldn't really find anything specific
I had a bunch of bookmark to www.asp.net/learn/, specially the one about data-access and
Had to download Command Line Tools from Apple to get make to work, but
Had a good read through similar topics but I can't quite a) find one
Had a good search here but can't see anything that gets my mind in
Had this working; at one stage. The problem is the following text is now
I had a question in MySQL, did it correctly. But the book code differs
I had a look at some other questions but I'm still not sure how
Some months ago I read a blog post which had a comparison of different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.