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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:57:53+00:00 2026-05-12T08:57:53+00:00

I can create an NSPredicate easily using an NSPredicateEditor (a subclass of NSRuleEditor). What

  • 0

I can create an NSPredicate easily using an NSPredicateEditor (a subclass of NSRuleEditor). What I’d like to know is this:

How can I take an existing NSPredicate (one created by the editor) and reload it into the editor so that I can alter it?

EDIT: I tried @John’s suggestion of using setObjectValue:, but that didn’t quite work. Let me explain my set up a bit more:

I’ve got a Document-based cocoa app, and the Document window just has an NSPredicateEditor on it. In the dataOfType:error: method, I have:

NSPredicate * pred = [predicateEditor objectValue];
NSData * predicateData = [NSKeyedArchiver archivedDataWithRootObject:pred];
return predicateData;

In the readFromData:ofType:error: method, I have:

NSPredicate * pred = [NSKeyedUnarchiver unarchiveObjectWithData:data];
[predicateEditor setObjectValue:pred];
return (pred != nil);

I’ve verified that the predicate is getting correctly archived and unarchived, but after opening a saved predicate, the predicate is not loaded into the predicateEditor. (Yes, predicateEditor is hooked up as an IBOutlet)

  • 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-12T08:57:53+00:00Added an answer on May 12, 2026 at 8:57 am

    Set the objectValue property of the NSPredicateEditor to the predicate in question.

    The documentation has this description of the loading process; does any of this seem like it might cause a problem with your setup?

    First, an instance of
    NSPredicateEditor is created, and some
    row templates are set on it—either
    through a nib file or
    programmatically. The first thing
    predicate editor does is ask each of
    the templates for their views, using
    templateViews.

    After setting up the predicate editor,
    you typically send it a
    setObjectValue: message to restore a
    saved predicate. NSPredicateEditor
    needs to determine which of its
    templates should display each
    predicate in the predicate tree. It
    does this by sending each of its row
    templates a matchForPredicate: message
    and choosing the one that returns the
    highest value.

    After finding the best match for a
    predicate, NSPredicateEditor copies
    that template to get fresh views,
    inserts them into the proper row, and
    then sets the predicate on the
    template using setPredicate:. Within
    that method, the
    NSPredicateEditorRowTemplate object
    must set its views’ values to
    represent that predicate.

    NSPredicateEditorRowTemplate next asks
    the template for the “displayable
    sub-predicates” of the predicate by
    sending a
    displayableSubpredicatesOfPredicate:
    message. If a template represents a
    predicate in its entirety, or if the
    predicate has no subpredicates, it can
    return nil for this. Otherwise, it
    should return a list of predicates to
    be made into sub-rows of that
    template’s row. The whole process
    repeats for each sub-predicate.

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

Sidebar

Related Questions

this question can create a misunderstanding: I know I have to use CSS to
I can create a stack class quite easily, using push and pop accessor methods
I can create a confirm box in Ext JS like this: with this code:
I can create the following and reference it using area[0].states[0] area[0].cities[0] var area =
In Postgresql you can create additional Aggregate Functions with CREATE AGGREGATE name(...); But this
Is there anyway I can create a not in clause like I would have
I want to know if i can create a custom google maps application,on which
I need to know if I can create a file in a specific folder,
I know I can create a custom event and associate data with it and
How I can create for my application one's own instance excel and use it

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.