unrecognized selector sent to instance

Discussion in 'Mac Programming' started by dbrayford, Mar 29, 2010.

  1. dbrayford macrumors member

    Joined:
    Feb 22, 2010
    #1
    Hi,
    I get the following error messages after a runtime crash. I am new to
    development on Apple systems and cocoa and struggling to create the
    native graphics window and attach it to the Java window.

    Code:
    2010-03-29 15:25:42.446 java[1075:13303] *** -[NSViewAWT Window]:
    unrecognized selector sent to instance 0x125e50e30
    2010-03-29 15:25:42.448 java[1075:13303] An uncaught exception was raised
    2010-03-29 15:25:42.448 java[1075:13303] *** -[NSViewAWT Window]:
    unrecognized selector sent to instance 0x125e50e30
    2010-03-29 15:25:42.449 java[1075:13303] *** Terminating app due to
    uncaught exception 'NSInvalidArgumentException', reason: '***
    -[NSViewAWT Window]: unrecognized selector sent to instance
    0x125e50e30'
    2010-03-29 15:25:42.449 java[1075:13303] Stack: (
       140735396678428,
       140735358576847,
       140735396705371,
       140735396698852,
       140735396699192,
       4925828763,
       4925835145,
       4364215618,
       4364177150,
       4364177150,
       4364176694
    )
    terminate called after throwing an instance of 'NSException'
    Abort trap

    The section of cde that it crashes in:

    Code:
           dsi = ds->GetDrawingSurfaceInfo(ds);
           if(dsi != NULL)
           {
                   dsi_mac = (JAWT_MacOSXDrawingSurfaceInfo*)dsi->platformInfo;
                   if( env->ExceptionOccurred() )
                   {
                           env->ExceptionDescribe();
                   }
           }
    
           std::cout << "Before NSView *view = dsi_mac->cocoaViewRef;" << std::endl;
    
           // get the corresponding peer from the calling panel
           NSView *view = dsi_mac->cocoaViewRef;
    
           std::cout << "Before NSView NSWindow *window = [view Window];" << std::endl;
    
           if(view)
                   std::cout << "view !=null" << std::endl;
    
           // get the coregraphics from the parent window
           // ******crashes here*****
           NSWindow *window = [view Window];
    
           std::cout << "Before NSOpenGLPixelFormatAttribute attrs[]" << std::endl;
    
           NSOpenGLPixelFormatAttribute attrs[] = {
    
                   NSOpenGLPFAScreenMask,
    
                   CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay),
    
                   NSOpenGLPFAColorSize, 24,
    
                   NSOpenGLPFADepthSize, 16,
    
                   NSOpenGLPFADoubleBuffer,
    
                   NSOpenGLPFAAccelerated,
    
                   0
    
           };
    
           NSOpenGLPixelFormat *pixelFormat;
    
           std::cout << "Before pixelFormat = [[NSOpenGLPixelFormat alloc]
    initWithAttributes:attrs];" << std::endl;
    
           pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
    
           std::cout << "Before initOpenGLView(env, panel);" << std::endl;
    
           initOpenGLView(env, panel);
    
    
           return 1;

    David
     
  2. JoshDC macrumors regular

    Joined:
    Apr 8, 2009
    #2
    A view's window method should be spelt with a lowercase w. "Unrecognized selector sent to instance" simply means that an object's been asked to perform a method it doesn't have. In this case the incorrectly capitalized Window method.
     
  3. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #3
    "Window" should be "window" (it's case-sensitive).
     

Share This Page