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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:41:23+00:00 2026-05-24T00:41:23+00:00

i have the following code in my application: NSArray *lstAttributes = [conditionAttribute componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator], *lstValues

  • 0

i have the following code in my application:

NSArray *lstAttributes = [conditionAttribute componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator],
    *lstValues = [conditionValue componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator],
    *lstValueTypes = [conditionValueType componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator];

if([lstAttributes count] != [lstValues count] ||
   [lstAttributes count] != [lstValueTypes count]) return NO;

BOOL bResult = YES;
NSLog(@"attributes amount - %u", [lstAttributes count]);
for(uint i = 0; i < [lstAttributes count]; i ++)
{
    NSLog(@"counter: %u", i);
    SystemUIConfigurationAttributeCondition *condition = [SystemUIConfigurationAttributeCondition new];

    condition.conditionAttribute = [lstAttributes objectAtIndex:i];
    condition.conditionValue = [lstValues objectAtIndex:i];
    condition.conditionValueType = [lstValueTypes objectAtIndex:i];

    bResult &= [self checkCondition:condition forOwner:owner];

    FreeObject(&condition);

    if(!bResult) break;
}

return bResult;

everything is fine in “debug” configuration. but once i switch it to “release” i face the endless loop. console shows me the following: attributes amount – 2, counter: 0, counter: 1, counter: 1, counter: 1, counter: 1, counter: 1, counter: 1, …… etc.

i tried to use different “for” and “while” operators, but nothing of that worked correctly. the loop still can’t be stopped.

has anyone faced the same problem before?

  • 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-24T00:41:24+00:00Added an answer on May 24, 2026 at 12:41 am

    workaround for this bug as promised:

    at first i tried to use code blocks to enumerate all objects in a list instead of “for” loop.

    __block BOOL bResult = YES;
    [lstAttributes enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop)
    {
        SystemUIConfigurationAttributeCondition *condition = [SystemUIConfigurationAttributeCondition new];
    
        condition.conditionAttribute = [lstAttributes objectAtIndex:idx];
        condition.conditionValue = [lstValues objectAtIndex:idx];
        condition.conditionValueType = [lstValueTypes objectAtIndex:idx];
    
        bResult &= [self checkCondition:condition forOwner:owner];
    
        FreeObject(&condition);
    
        if(!bResult) *stop = YES;
    }];
    

    but i got a crash on second iteration. “lstValues” and “lstValueTypes” pointers suddenly changed their values and application received EXC_BAD_ACCESS. possibly usage of 3 arrays while enumerating only 1 of them is not a good idea. debugger shows that enumeration is performed on the same thread, but 2 of 3 arrays are corrupted by the moment of 2nd iteration.

    so i decided to split up my initial loop into 2 parts:

    1. prepare a list of conditions
    2. check each condition.

    first is a usual “for” loop, second – ‘enumerateObjectsUsingBlock:” method of NSArray class. so the final code looks like:

    NSArray *lstAttributes = [conditionAttribute componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator],
        *lstValues = [conditionValue componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator],
        *lstValueTypes = [conditionValueType componentsSeparatedByString:cstrSystemUIConfigurationAttributeConditionSeparator];
    
    if([lstAttributes count] != [lstValues count] ||
       [lstAttributes count] != [lstValueTypes count]) return NO;
    
    NSMutableArray *lstConditions = [NSMutableArray new];
    for(uint i = 0; i < [lstAttributes count]; i ++)
    {
        SystemUIConfigurationAttributeCondition *condition = [SystemUIConfigurationAttributeCondition new];
    
        condition.conditionAttribute = [lstAttributes objectAtIndex:i];
        condition.conditionValue = [lstValues objectAtIndex:i];
        condition.conditionValueType = [lstValueTypes objectAtIndex:i];
    
        [lstConditions addObject:condition];
        FreeObject(&condition);
    }
    
    __block BOOL bResult = YES;
    [lstConditions enumerateObjectsUsingBlock:^(id obj, NSUInteger i, BOOL *stop) 
    {
        if([self checkCondition:[lstConditions objectAtIndex:i] forOwner:owner] == NO)
        {
            bResult = NO;
            *stop = YES;
        }
    }];
    
    FreeObject(&lstConditions);
    
    return bResult;
    

    this code works.

    i would appreciate if anyone can explain the behavior of my initial loop.

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

Sidebar

Related Questions

I have following code in my application: // to set tip - photo in
I have following code in my Application. Comments in my code will specify My
I have following code in my application. [self.navigationController pushViewController:x animated:YES]; It will push a
I have the following code in a strongly-typed View in my application: <td> <label
Work on this small test application to learn threading/locking. I have the following code,
I have the following automation code: lPrintSetup := fWordObject.Application.Dialogs.Item(wdDialogFilePrintSetup); lPrintSetup.Printer := 'MyPrinter'; lPrintSetup.DoNotSetAsSysDefault :=
I have the following sample code in a VB.NET console application. It compiles and
I have a C# application that includes the following code: string file = relativePath.txt;
I have a simple application with the following code: FileInfo[] files = (new DirectoryInfo(initialDirectory)).GetFiles();
I have following code in my Application. tmp=[[UILabel alloc] initWithFrame:label1Frame]; tmp.tag=1; tmp.textColor=[UIColor blackColor]; [tmp

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.