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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:52:53+00:00 2026-06-09T14:52:53+00:00

I have a NSObject class in which I am sending a NSDictionary object too,

  • 0

I have a NSObject class in which I am sending a NSDictionary object too, the class object then sets all the entries in the NSDictionary to their native types that are variables in the NSObject class.

I would then like to pass this NSObject class into its own NSMutableArray however my app is crashing when this happens.

below is the code calling the NSObject Class and then trying to set it into a NSMutableArray.

NSArray *filteredArray = parsedDataArrayOfDictionaries; //dictionary entries are currently in nsstring format
SearchResultList *searchResultList = [[SearchResultList alloc]init];
NSMutableArray *testArray = [[NSMutableArray alloc] init];

int myCount = 0;

while (myCount <= [filteredArray count]) {
    //call class and pass current NSDictionary in array[myCount]
    [searchResultList assignSearchData:filteredArray[myCount]];
    searchResultList = (SearchResultList*)[testingDic objectForKey:@"myObject"];
    testArray[myCount] = searchResultList; //create array of nsobjectclassed, this is also where the app fails
    NSLog(@"%@", testArray[myCount]);
}

Hopefully this is making some sense, I am getting abit lost in the middle of the while statements… I know I need to get back the NSObject Class then assign it to an array.. but im just not sure how to do this, 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-06-09T14:52:55+00:00Added an answer on June 9, 2026 at 2:52 pm

    You are exceeding the size of the array filteredArray

    while (myCount <= [filteredArray count]) {
    

    should read

    while (myCount <[filteredArray count]) {
    

    as the count of an array is one higher than the last object’s index, as the indices starts at 0.

    honestly I am not sure, what you are trying to achieve, but you should consider to use fast enumeration instead of the while statement

    for (id obj in filteredArray) {
    

    or even fancier block-based enumeration

    NSMutableArray *testArray = [[NSMutableArray alloc] init];
    [filteredArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        //...
        [testArray addObject:obj];
    }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object from a NSObject class that I call brand and has
I have some NSMutableArray in tableView which contain class Lesson @interface Lesson : NSObject
I have a class called XYZ inheriting from NSObject and an array which contains
I have a custom NSObject class(Downloader) which uses NSOperationQueue to download images and as
I have a class which is an NSObject type, and in a view it
I have a Singleton Class SharedDataObject which has a another class object myClass. MyClass
I have an Objective-C class which one of it's variables is an C++ object
I have two classes, a class1 which is an NSObject and a class2 which
I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I have the following simple class definition: //mycommon.h @interface CurrentPath : NSObject @property (nonatomic,

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.