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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:57:47+00:00 2026-06-03T13:57:47+00:00

As a MacRuby beginner I am working through this tutorial , and want to

  • 0

As a MacRuby beginner I am working through this tutorial, and want to add a drop-down sheet to warn when the user tries to delete an entry from the app.

Following the code here, which in Obj-C is

- (IBAction)deleteRecord:(id)sender 
{
  NSString *title = @"Warning!";
  NSString *defaultButton = @"Delete";
  NSString *alternateButton = @"Don't Delete";
  NSString *otherButton = nil;
  NSString *message = @"Are you sure you want to delete the selected record(s)?";

  if ( [tableView numberOfSelectedRows] == 0 )
    return;

  NSBeep();
  NSBeginAlertSheet(title, defaultButton, alternateButton, otherButton, mainWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:), nil, nil, message);
}

I have in MacRuby:

def removeFriend(sender)
  return if @friendsTableView.numberOfSelectedRows == 0
  title = 'Warning!'
  defaultButton = 'Delete'
  alternateButton = 'Don\'t Delete'
  otherButton = nil
  s = @friendsTableView.numberOfSelectedRows > 1 ? 's' : ''
  message = "Are you sure you want to delete the selected record#{s}?"
  NSBeginAlertSheet(title, defaultButton, alternateButton, otherButton, @mainWindow, self, :'alertDidEnd:returnCode:contextInfo:', nil, nil, message)
end

and for alertDidEnd:returnCode:contextInfo:

def alertDidEnd(sheet, returnCode:rCode, contextInfo:cInfo)
  <array handling code>
end

When this runs I get a drop-down sheet when the button linked to removeFriend is clicked, but then if I click “Delete” my app crashes with the following error:

unknown: [BUG] unknown Objective-C immediate: 0x1 (nil)

MacRuby 0.12 (ruby 1.9.2) [universal-darwin10.0, x86_64]

(lldb) 

Am I doing something wrong with the way the didAlertEnd method is implemented, or is this actually a bug?

  • 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-03T13:57:48+00:00Added an answer on June 3, 2026 at 1:57 pm

    Apparently a MacRuby bug: http://www.macruby.org/trac/ticket/1368

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

Sidebar

Related Questions

In this tutorial for sheet programming in cocoa, I am told to invoke the
i have a simple macruby application and i want to get some user-input via
I want to use MacRuby to tell Mail.app to check for new email. But
I have a macruby project in xcode, in which I want to replace all
I have been using MacRuby and running through the book MacRuby:The Definitive Guide by
I'm doing my first steps in MacRuby. Does anyone know how I can add
I'm working on a MacRuby application that needs to make updates to config files
I'm developing a tool for XSS checking, using the Webkit WebView and Macruby. This
I'm working on a OS X program where the user does some light WYSIWYG
From a previous post I got Ruby mode working in emacs. This is working

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.