【问题标题】:invoke framework in termimal the window seems to be blocked在终端调用框架窗口似乎被阻止
【发布时间】:2014-12-30 11:31:26
【问题描述】:

现在,我有一个名为“MyFramework.framework”的框架,其中包含一个window.nib,我编写了一个示例来在终端中调用它。 代码:

//<MyFramework/myUI.h>

#ifndef Frmwork_myUI_h
#define Frmwork_myUI_h

#ifdef __cplusplus
extern "C"{

#endif

void ShowDialog();

#ifdef __cplusplus

}
#endif

#endif

//test.mm

#include <MyFramework/myUI.h>

#include <Foundation/NSRunLoop.h>

int main(int argc, char *argv[])

{

    ShowDialog() ;
    while (!isTransmitCompleted)
    {
       [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
    }
    return 0;

}
//build test.mm

g++ -c test.mm -o test.o

g++ test.o -o test -lpthread -framework Cocoa -framework AppKit -framework CoreData -framework Foundation -framework MyFramework

//run

$./test

Dialog可以出现,但是好像被卡住了,没有焦点,我不能输入任何东西,我什么也不能做,怎么了?

【问题讨论】:

    标签: objective-c macos frameworks dylib


    【解决方案1】:

    现在,我得到了解决方案。

    在 OS X 10.6 中,我为 Safari 编写了一个 npapi 插件,在这个插件中,我调用了一个显示模式窗口的框架来获取密码。关闭此模态窗口后,Safari 似乎被阻止了。

    在我的框架中,我通过 runModalForWindow 函数显示此模式窗口,当我更改为 runModalSession 时,一切正常。我不知道为什么,但它确实对我有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多