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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:35:44+00:00 2026-05-14T21:35:44+00:00

I have an AUDIO class. This audio has a SOUND_A subclass and a SOUND_B

  • 0

I have an AUDIO class. This audio has a SOUND_A subclass and a SOUND_B subclass. This is all done correctly and is working fine.

I have another model, lets call it PLAYLIST_JOIN, and this can contain (in the real world) SOUND_A’s and SOUND_B’s, so we give it a relationship of AUDIO and PLAYLIST.

This all works in the app.

The problem I am having now is querying the PLAYLIST_JOIN table with an NSPredicate. What I want to do is find an exact PLAYLIST_JOIN item by giving it 2 keys in the predicate

sound_a._sound_a_id = %@ && playlist.playlist_id = %@

and

sound_b.sound_b_id = %@ && playlist.playlist_id = %@

The main problem is that because the table does not store sound_a and sound_b, but stored audio, I cannot use this syntax. I do not have the option of reorganizing the sound_a and sound_b to use the same _id attribute name, so how do I do this?

Can I pass a method to the predicate? something like this:

= %@ && playlist_id = %@

  • 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-14T21:35:45+00:00Added an answer on May 14, 2026 at 9:35 pm

    It gets a little complicated but you need to add a third condition to the predicate:

    (entity.name = sound_a && _sound_a_id = %@ && playlist.playlist_id = %@) && (entity.name = sound_b && sound_b_id = %@ && playlist.playlist_id = %@)
    

    This is assuming you are querying against the audio abstract and telling it to return subclasses. Because the condition is checked left to right, if the first condition fails it will move on and not throw errors because _sound_a_id does not exist.

    The first condition is referencing the NSEntityDescription that is a part of the NSManagedObject and its name attribute is just a string.

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

Sidebar

Related Questions

I have an audio project I'm working on using BASS from Un4seen. This library
I have a Content model which has one or many Audio files which need
I have a model with a has_one and polymorphic association like this: class Disc
I have an android app that plays audio from the application class. I have
I have an app on the market that records audio using the AudioRecord class
I have one audio file captured from my iphone. I want to upload this
I have an entity model that has audit information on every table (50+ tables)
I have a table data like this: <table class=tablesorter id=dea> <thead> <tr> <th class=header
lets say i have classA which is a class of audio,that sample the audio
I am working on a project for my computer security class and I have

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.