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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:40:29+00:00 2026-06-11T12:40:29+00:00

I have two classes: GHHaiku and GHViewController . In GHHaiku , I declare @property

  • 0

I have two classes: GHHaiku and GHViewController. In GHHaiku, I declare @property (nonatomic, strong) NSArray *arrayAfterFiltering;.

In GHViewController I instantiate GHHaiku as @property (nonatomic, strong) GHHaiku *ghhaiku; and then follow it later with this code:

        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"category == %@", cat];
        NSArray *filteredArray = [self.haiku filteredArrayUsingPredicate:predicate];  //haiku is an NSMutableArray property of `GHViewController`
        NSLog(@"%d",filteredArray.count);

The NSLog here produces the correct count, 116.

But when I use the following code,

        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"category == %@", cat];
        self.ghhaiku.arrayAfterFiltering = [self.haiku filteredArrayUsingPredicate:predicate];
        NSLog(@"%d",self.ghhaiku.arrayAfterFiltering.count);

the NSLog produces a count of 0.

Why is this any different?

  • 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-11T12:40:31+00:00Added an answer on June 11, 2026 at 12:40 pm

    The problem is when you say that you instantiate @property (nonatomic, strong) GHHaiku *ghhaiku. You don’t. All you do there is declare the property. So you have a property but the property has no value; it is nil. So self.ghhaiku is nil and you are fruitlessly sending messages to nil in your second example.

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

Sidebar

Related Questions

I have two classes, one nested in the other. Public Class Operation Public Property
I have two classes in my app, GHHaiku (a subclass of NSObject ) and
I have two classes (MVC view model) which inherits from one abstract base class.
I have two classes A and B generated by cxf-codegen-plugin from my WSDL. A
I have two classes Foo and Bar . The tables in the database look
I have two classes Foo and Bar that Bar extends Foo as below: class
I have two classes, Item and SoldItem . SoldItem inherits from Item adding some
I have two classes, one that inherits from the other. The base class is
I have two classes, TestA and TestB . TestA extends QObject . I have
I have two classes set up as follows: class Point { protected: double coords[3];

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.