# Attaching GLFW (MAC) Cocoa Window to IPlugView (PLEASE HELP)

**URL:** <https://forums.steinberg.net/t/attaching-glfw-mac-cocoa-window-to-iplugview-please-help/824240>\
**Category:** VST 3 SDK\
**Tags:** mac, gui\
**Created:** [December 22, 2022, 8:26am UTC](https://forums.steinberg.net/t/attaching-glfw-mac-cocoa-window-to-iplugview-please-help/824240 "2022-12-22T08:26:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakey\_t](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jakey\_t](https://forums.steinberg.net/u/jakey_t)\
**Post date:** [December 22, 2022, 8:26am UTC](https://forums.steinberg.net/t/attaching-glfw-mac-cocoa-window-to-iplugview-please-help/824240/1 "2022-12-22T08:26:03Z")

</div>

Hi i’m currently trying to use GLFW as my host’s vst editor window but am getting the error:

```auto
[GLFWWindow window]: unrecognized selector sent to instance 0x7fe10430a830
2022-12-22 08:11:08.981 MyHost[1593:20791] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GLFWWindow window]: unrecognized selector sent to instance 0x7fe10430a830'
*** First throw call stack:
(
        0 CoreFoundation 0x00007fff37903a17 __exceptionPreprocess + 250
        1 libobjc.A.dylib 0x00007fff70468a9e objc_exception_throw + 48
        2 CoreFoundation 0x00007fff37982e36 -[NSObject(NSObject) __retain_OA] + 0
        3 CoreFoundation 0x00007fff37868190 ___forwarding___ + 1427
        4 CoreFoundation 0x00007fff37867b68 _CF_forwarding_prep_0 + 120
        5 Digitalis 0x000000010a9dc990 GetPluginFactory + 1922288
        6 Digitalis 0x000000010a9dbb85 GetPluginFactory + 1918693
        7 Digitalis 0x000000010a80db6e GetPluginFactory + 26318
        8 MyHost 0x000000010a624641 _ZN6Plugin4loadERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 2065
        9 MyHost 0x000000010a624e9d main + 61
        10 libdyld.dylib 0x00007fff71608cc9 start + 1
        11 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

```

i guess this leads me to question whether the kPlatformType “NSView” is equivalent to glfwGetCocoaWindow()'s “NSWindow” return value?

heres the snippet of code thats causing errors:

```auto
  if (!glfwInit()) {
    std::cout << "Failed to initialise Editor Window" << std::endl;
    return false;
  }

  auto view = controller->createView(Steinberg::Vst::ViewType::kEditor);

  Steinberg::ViewRect dimensions;
  
  view->getSize(&dimensions);

  editorWindow = glfwCreateWindow(dimensions.getWidth(), dimensions.getHeight(), "VST 3 SDK", nullptr, nullptr);
  
  view->attached(glfwGetCocoaWindow(editorWindow), Steinberg::kPlatformTypeNSView);

```

can also confirm that the windows equivalent of this works fine:

```auto
view->attached(glfwGetWin32Window(editorWindow), Steinberg::kPlatformTypeHWND);

```

---

<div class="post-metadata">

**Author:** ![Arne\_Scheffler](https://dub1.discourse-cdn.com/steinberg/user_avatar/forums.steinberg.net/arne_scheffler/32/92023_2.png) [@Arne\_Scheffler](https://forums.steinberg.net/u/Arne_Scheffler)\
**Post date:** [January 2, 2023, 6:44pm UTC](https://forums.steinberg.net/t/attaching-glfw-mac-cocoa-window-to-iplugview-please-help/824240/2 "2023-01-02T18:44:07Z")

</div>

You must call the attach method with a NSView object not a NSWindow object.
