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

The Archive Base Latest Questions

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

for(NSInteger i = 0; i<[_tempPostalCodeList count]; i++){ ***if(individualInfo.postalCode == [[_tempPostalCodeList objectAtIndex:i] postalCode])***{ myAnnotation.title =

  • 0
for(NSInteger i = 0; i<[_tempPostalCodeList count]; i++){
            ***if(individualInfo.postalCode == [[_tempPostalCodeList objectAtIndex:i] postalCode])***{
                myAnnotation.title = [NSString stringWithFormat:@"%i Records!", [[_postalCount objectAtIndex:i] intValue]];
            }
    }

I Do not know what is wrong with this piece of code. That line has a error.
This works for Java but not for objective c. =( Someone plz help

  • 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-23T18:43:49+00:00Added an answer on May 23, 2026 at 6:43 pm

    Despite the lack of a lot of information in the question, my psychic powers tell me that the problem is that the message -objectAtIndex: of the NSArray class returns a generic object of type id. So, the expression [[_tempPostalCodeList objectAtIndex:i] postalCode] is sending the postalCode message to an object of type id. Since the compiler doesn’t know the underlying type of the actual object, it can’t deduce the return type of the postalCode message, so it assumes that it also returns id.

    id is a pointer type, and since postalCode is an integral type, the compiler thinks you’re trying to compare a pointer with an integer when it evaluates the == operator, hence the warning. The way to fix this is to either insert a cast, or introduce a temporary variable:

    // Option #1: Use a cast
    if(individualInfo.postalCode ==
        [(MyClass*)[_tempPostalCodeList objectAtIndex:i] postalCode]) {
        ...
    }
    
    // Option #2: Use a temporary variable
    MyClass *obj = [_tempPostalCodeList objectAtIndex:i];
    if(individualInfo.postalCode == obj.postalCode) {
        ...
    }
    

    The reason that you can use a temporary variable without a cast is because the id type (returned by -objectAtIndex:) can be implicitly cast to any Objective-C class type by simple assignment (similar to how in C (but not C++), the void* type can be implicitly cast to any pointer type).

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

Sidebar

Related Questions

NSString *x = @12345; NSInteger nsint = [x integerValue]; NSLog(@%x, nsint); Prints 3039. intValue
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [topics count]; } - (UITableViewCell *) getCellContentView:(NSString *)cellIdentifier
I have : NSInteger dollarrow = [ValuesPicker selectedRowInComponent:kDollar]; NSString *dollar = [dollarlist objectAtIndex:dollarrow]; double
-(void)insertDataImage_ID:(NSInteger)ID ImageName:(NSString*)Image Bookmark:(NSString*)Title { [self checkAndCreateDB]; sqlite3 *database; if (sqlite3_open([DBPath UTF8String], &database)==SQLITE_OK) { NSString
I want to count the lines in an NSString in Objective-C. NSInteger lineNum =
I have a class that has a method: -(NSInteger) getCityCountForState:(NSString *)state CityArray:(NSMutableArray *)cityArray {
NSInteger *count = [monLessonArrayA count]; for (i = 0; i < count; i++) {
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSLog(@bla %@, [section count]); return [possessions count]; } Does anyone
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { } Hi I am very new in objective c.......................through
Why does this not work: NSInteger temp = 20; [userSettingsFromFile setObject:temp forKey:@aTemp]; but this

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.