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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:33:19+00:00 2026-06-03T22:33:19+00:00

Most of this code is derived directly from the RubyMotion Locations sample. I defined

  • 0

Most of this code is derived directly from the RubyMotion Locations sample.

I defined a simple NSManagedObject:

class Text < NSManagedObject
  def self.entity
    @entity ||= begin
      # Create the entity for our Text class. The entity has 2 properties. 
      # CoreData will appropriately define accessor methods for the properties.
      entity = NSEntityDescription.alloc.init
      entity.name = 'Text'
      entity.managedObjectClassName = 'Text'
      entity.properties = ['main', NSStringAttributeType,'display',NSStringAttributeType].each_slice(2).map do |name, type|
            property = NSAttributeDescription.alloc.init
            property.name = name
            property.attributeType = type
            property.optional = false
            property
          end
      entity
    end
  end 
end

I cannot seem to access the display method inside my controller:

def tableView(tableView, cellForRowAtIndexPath:indexPath)
    cell = tableView.dequeueReusableCellWithIdentifier(CellID) || UITableViewCell.alloc.initWithStyle(UITableViewCellStyleSubtitle, reuseIdentifier:CellID)
    text = TextStore.shared.texts[indexPath.row]

    cell.textLabel.text = text.display
    cell.detailTextLabel.text = text.main[0,10] + "...."
    cell
  end

I keep getting this exception:

Terminating app due to uncaught exception 'NoMethodError', reason: 'text_controller.rb:40:in `tableView:cellForRowAtIndexPath:': private method `display' called for #<Text_Text_:0x8d787a0> (NoMethodError)

I’ve tried making a variety of changes to the Text class and TextStore class (model). Nothing has resolved this issue so far. I’ve done some research in Apple’s documentation online, but have not found any clues there.

I’ve worked around it by using the main property. I’m hoping someone can help me understand why I’m seeing this behavior.

  • 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-03T22:33:20+00:00Added an answer on June 3, 2026 at 10:33 pm

    Though I can’t find it documented anywhere, it seems that display is a private method on just about every object in RubyMotion. Even a completely blank class throws an exception on this, unless you specify a display attribute:

    (main)>> class Foo; end
    => nil
    (main)>> f = Foo.new
    => #<Foo:0x8ee2810>
    (main)>> f.display
    => #<NoMethodError: private method `display' called for #<Foo:0x8ee2810>>
    
    (main)>> class Foo; attr_accessor :display; end
    => nil
    (main)>> f = Foo.new
    => #<Foo:0xa572040>
    (main)>> f.display
    => nil
    

    My guess is that in the way NSManagedObject works, it doesn’t initially know that the object being managed has a display attribute, so it throws the error about the private method instead. While there may be a way to work around this, I would just avoid having variable names that conflict with these private methods.

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

Sidebar

Related Questions

Title is most of the question, what allows this to be valid code? Is
I know this is most-likely a simple question but when you restore a database
Python documentations states : Exceptions should typically be derived from the Exception class, either
Say, the code class Derived: public Base {....} Base* b_ptr = new( malloc(sizeof(Derived)) )
I have a class ( MyClass ) that inherits most of its functionality from
I have this code getting back a password from the keychain for a given
I am trying to write a parser class derived from the Python argparse ArgumentParser
I am having this most annoying issue when I try to rebuild my solution
As we do this most of the time to increase the Maximum execution time
I'm new to most of this so forgive me if I'm doing something really

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.