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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:44:45+00:00 2026-06-05T23:44:45+00:00

I am having trouble using the ABPersonViewController with RubyMotion. The error I’m getting is

  • 0

I am having trouble using the ABPersonViewController with RubyMotion. The error I’m getting is

Objective-C stub for message setDisplayedPerson:' typev@:^v’ not precompiled. Make sure you properly link with the framework or library that defines this message.

I suspect this is due to RubyMotion not casting to the type IOS expects. I think ABPersonCreate() is returning a CFType but the displayedPerson setter is expecting it to be cast as a ABRecordRef (that’s just a guess from the error messages)

Here’s the sample code to see the problem (based on Apple’s QuickContacts sample):

#Rakefile
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'contacts'
  app.frameworks += ['AddressBook', 'AddressBookUI']
end

and

# app/app_delegate.rb
class AppDelegate
  def application(application, didFinishLaunchingWithOptions:launchOptions)
    window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.applicationFrame)
    window.rootViewController = UINavigationController.alloc.init
    window.rootViewController.wantsFullScreenLayout = true
    window.makeKeyAndVisible
    true

    # This works
    add_person('Alex', 'Rothenberg')

    # This fails (is it a type casting problem?)
    show_person_view_controller('Rothenberg')
  end

  def show_person_view_controller(name)
    anError = nil

    address_book = ABAddressBookCreate();
    people = ABAddressBookCopyPeopleWithName(address_book, name);
    person = people.first
    picker = ABPersonViewController.alloc.init.autorelease

    picker.personViewDelegate = self
    puts "Should this be an AddressBookRef? #{person.inspect}" # => #<__NSCFType:0x8c3bec0>
    picker.displayedPerson = person
    # The previous line fails
    puts "We never reach this line!"

    self.navigationController.pushViewController(picker, animated:true)
  end

  def add_person(first_name, last_name)
    error = nil
    contact = ABPersonCreate()
    ABRecordSetValue( contact, KABPersonFirstNameProperty, first_name, error )
    ABRecordSetValue( contact, KABPersonLastNameProperty, last_name, error )

    address_book = ABAddressBookCreate()
    ABAddressBookAddRecord( address_book, contact, error )
    ABAddressBookSave( address_book, error )
  end
end

When you run it we are able to add to the address book in the add_person method but it fails in show_person_view_controller on the line picker.displayedPerson = person

$ rake
     Build ./build/iPhoneSimulator-5.1-Development
  Simulate ./build/iPhoneSimulator-5.1-Development/contacts.app
Should this be an AddressBookRef? #<__NSCFType:0x8da2900>
Objective-C stub for message `setDisplayedPerson:' type `v@:^v' not precompiled. Make sure you properly link with the framework or library that defines this message.

Any suggestions would be 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-05T23:44:47+00:00Added an answer on June 5, 2026 at 11:44 pm

    This will work properly as of RubyMotion 1.12 (run sudo motion update).

    • Fixed a bug where performing Objective-C methods that accept
      CFType objects
      would crash the program (ex. [ABPersonViewController setDisplayedPerson:]).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble using python function decorators in Google's AppEngine. I'm not that familiar
I'm having trouble using Simple Xml Serializer to build a Message from a complex
I'm having trouble using prev() in jQuery where it's not selecting the right element.
Having trouble using libstatgrab -- I receive the following error at compile time: libstatgrabTest.cpp:16:
I am having trouble using .find() as in console it says .find is not
Anybody having trouble using AVFoundation with GC ON??? What I am experiencing is that
I am having trouble using the //TODO flag. When I put the //TODO comment
I'm having trouble using jQuery.ajax() to post a gist to Github. The gist is
I'm having trouble using Short2 for the (x,y) positions in my vertex data. This
I'm having trouble using python to write strings into a file: (what I'm trying

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.