2012-05-08 2 views
0

MacRuby 초급 사용자로서이 tutorial을 통해 작업 중이며 드롭 다운 시트를 추가하여 사용자가 삭제하려고 할 때 경고합니다. 앱의 항목. 의 Obj-C에있는 코드 here, 다음MacRuby NSBeginAlertSheet 호출이 알려지지 않음 : [BUG] 알 수 없음 Objective-C immediate : 0x1 (nil)

- (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); 
} 

내가 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 

alertDidEnd:returnCode:contextInfo을 위해 :

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

를이 내가 얻을 실행하면 removeFriend에 연결된 버튼이 클릭되면 드롭 다운 시트 내가 클릭하면 편하지만, 다음 오류와 함께 내 응용 프로그램 충돌을 "삭제"

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

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

(lldb) 

은 내가 didAlertEnd 방법이 구현되는 방식에 뭔가 잘못하고 있는가, 또는 이것은 실제로 버그?

답변