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

  • Home
  • SEARCH
  • 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 5936389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:23:31+00:00 2026-05-22T15:23:31+00:00

m_cAppIdMap is an object of a dictionary. I want to iterate through the dictionary

  • 0

m_cAppIdMap is an object of a dictionary.
I want to iterate through the dictionary and to ind and remove the value pEvent.wTimerId is an unsigned short integer that is stored as key in the dictionary.

if(unsigned short* key in m_cAppIdMap) //error:Expected expression before 'unsigned'
            {
            (void)[self findAndRemoveEvent:pEvent];
            (void)CFDictionaryRemoveValue(m_cAppIdMap,&wTimerId); 
            free(pEvent);
            bReturn = YES;
           }

I am getting an error when i try to iterate through the loop.

EDITED

-(BOOL)KillTimer:(unsigned short)wTimerId
{
    stRs232Timer* pEvent;
    BOOL bReturn=FALSE;

    theLock = [[NSLock alloc]init];

    if ([theLock tryLock]) {
    //  if ( m_cAppIdMap.Lookup(wTimerId,pEvent) )
    //  {
    //      (void)findAndRemoveEvent(pEvent);                   // remove from event queue
    //      (void)m_cAppIdMap.RemoveKey(wTimerId);              // remove from app map
            for(wTimerId in m_cAppIdMap)
            {
             (void)[self findAndRemoveEvent:pEvent];
             (void)CFDictionaryRemoveValue(m_cAppIdMap,&wTimerId); 
             free(pEvent);
             bReturn = YES;
           }

        [theLock unlock];
    }   

    return bReturn;
}

I am getting error in this code ‘selector element does not have a valid object type’ . I need to search for wTimerId(key) in the m_cAppIdMap. Is it what i’m doing is correct.The commented lines above the for loop is the implementation of the same code in cpp. I coud not make the same logic over here in Objective C.

  • 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-22T15:23:32+00:00Added an answer on May 22, 2026 at 3:23 pm

    I think you meant to use for rather than if. Additionally, the fast enumeration syntax
    for (x in y) can only be used on objects that implement the NSFastEnumeration protocol—typically NSArray. It looks like you’re using C arrays, so this syntax won’t work anyway.

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

Sidebar

Related Questions

NSData* myData = [NSData dataWithBytes:&pEvent length:sizeof(pEvent)]; wTimerId = 99; [m_cAppIdMap setObject:myData forKey:[NSNumber numberWithUnsignedShort:wTimerId]]; wTimerId
m maintaining a project, that has to be compatible through PHP 4.X to 5.2.
m.pen = Pens.Red; //No error m.pen.EndCap = System.Drawing.Drawing2D.LineCap.Square; //error Where m is an object
m.google.com somehow requests the current location when loaded in Android's browser. I want to
I'm running Drupal 7 with JQuery and Node.js. I want an event to happen
m is a ndarray with shape (12, 21, 21), now I want to take
'm trying to make a small modification to django lfs project, that will allow
I'm using FileWriter to write to a file and noticed that even after I
-(BOOL)createTimer { stRs232Timer* pEvent = malloc(sizeof(stRs232Timer)); pEvent->bPersistent = YES; // setup timer structure pEvent->wAppTimerId
m new to development and i want to know what is the main thing

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.