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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:00:35+00:00 2026-06-13T06:00:35+00:00

I cannot save the selected item from the array with a string value. Any

  • 0

I cannot save the selected item from the array with a string value. Any idea what’s wrong?

Its my code of compare:

if(self.detailItem){
    [WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:[self.detailItem description] ofType:@"html"]isDirectory:NO]]];
    NSString *value = (NSString *)self.detailItem;
    NSString *value1 = (NSString *)@"DecideVectorVPiramidi";
    value=[NSString stringWithFormat:@"%@", value];
    value1=[NSString stringWithFormat:@"%@", value1];
    if (value == value1) {
        WebView.scalesPageToFit=YES;
    }

This is the array code:

case 1:
            switch (self.nomberInSection) {
                case 0:
                    self.detailViewController.detailItem =[NSString stringWithFormat:@"%@", [DecideOfZakusPath objectAtIndex:indexPath.row]];
                    break;
            }
break;

Type of detailItem is id.

For errors, I checked

  • 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-06-13T06:00:36+00:00Added an answer on June 13, 2026 at 6:00 am

    You need to use isEqualToString. The ==operator will compare by reference only.

    This means you have to do

    if ( [value isEqualToString:value1] )
    {
        ...
    

    Your two strings will be pointers to two different memory locations, and the == will compare those two memory locations, and consequently evaluate to NO. The isEqualToString, or isEqual, is the method to use for doing a string comparison using the string equality rules (ie. if the two strings contains the same characters, they are considered equal).

    This can be a bit counter-intuitive. In Objective-C, operator overloading is not possible. In many other languages, the operators can be overloaded so that a value comparison for built in and custom classes can be done using the equality operator.

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

Sidebar

Related Questions

All of a sudden, I cannot save any models in my PostgreSQL database in
I am using datimepicker (from: http://trentrichardson.com/examples/timepicker/ ) however I cannot save the picket date-time
How can I compile a string from selected rows of a file, run some
I'm using Eclipse 3.7 on Ubuntu. Often, after editing a file, I cannot save
I cannot work this out to save my life! So, I have a Codeigniter
Cannot find any example on Google.
My purpose is to process one image from image library, and save this image
I have a list box that when an item is selected or deselected I
For instance, here is sample JPEG which I cannot SAVE (!) but can read
So I have this script that reads the xml, modifies the selected node value

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.