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 6112883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:47:44+00:00 2026-05-23T14:47:44+00:00

I am fairly new to objective c and cocoa, however i have spent a

  • 0

I am fairly new to objective c and cocoa, however i have spent a lot of time with c++, and I have never run across this issue before.

My application needs to identify a mounted disk by name. Here is the code:

//this code will run whenever a new disk is mounted to the computer
-(void) scanForKindle:(NSNotification *) notification 
{
    NSMutableArray *mountedDisks = [[NSMutableArray alloc] init];
    mountedDisks = [workspace mountedRemovableMedia];
    NSMutableArray *ebookDevices = [[NSMutableArray alloc] init];
    NSDictionary *fileAttributes = [[NSDictionary alloc] init];

    int currentDisk;

    for (currentDisk = 0; currentDisk < [mountedDisks count]; currentDisk++)
    {
        NSLog(@"Name: %@", [mountedDisks objectAtIndex:currentDisk]);

        if ([mountedDisks objectAtIndex:currentDisk] == @"/Volumes/Kindle")
        {
            NSLog(@"Kindle has been identified");
        }
    }
} 

I have gotten everything to work perfectly up to the if statement in the for loop. It simply wont run. any ideas why? I am sure this is a simple fix, but I cannot figure this out for the life of me.

Any help would be greatly appreciated!

  • 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-23T14:47:45+00:00Added an answer on May 23, 2026 at 2:47 pm

    That’s because you are making pointer comparison between two different instances of NSStrings.

    Do this instead –

    if ([[mountedDisks objectAtIndex:currentDisk] isEqualToString:@"/Volumes/Kindle"])
    {
        NSLog(@"Kindle has been identified");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all! I'm fairly new to objective-c so I have never had to tackle
I'm fairly new to Objective-C and cocoa programming, so I don't really understand the
I am fairly new to Objective-C and whilst running the Clang static analyser this
I'm fairly new to Cocoa and Objective-C. Currently I'm developing a fairly basic application
im fairly new to objective-c, most of it is clear however when it comes
I'm fairly new to Objective-C, and this is my first question on StackOverflow. Please
Being fairly new to iPhone / Objective-C development, I wanted to ask this question
I'm fairly new to Objective-C and iPhone programming so I apologize if this is
Ok guys, I am fairly new to objective C. I have an app that
fairly new to Objective-C and iOS development (coming from PHP) and I have a

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.