Cocoa 在Leopard中的WebView中显示内容时出现问题
我制作了一个示例应用程序,包括:WebView(显示URL的内容)、textfield(包含URL)、button(在WebView中加载URL) 我使用此方法在WebView中显示内容:Cocoa 在Leopard中的WebView中显示内容时出现问题,cocoa,webview,Cocoa,Webview,我制作了一个示例应用程序,包括:WebView(显示URL的内容)、textfield(包含URL)、button(在WebView中加载URL) 我使用此方法在WebView中显示内容: - (IBAction)displayAction:(id)sender{ NSString *liveStreamLink = [[NSString alloc] initWithString:[livestreamLinkTextField stringValue]]; [[livestr
- (IBAction)displayAction:(id)sender{
NSString *liveStreamLink = [[NSString alloc] initWithString:[livestreamLinkTextField stringValue]];
[[livestreamDisplayView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:liveStreamLink]]];
}
我在Leopard和SnowLeopard中都做了这个应用程序
在这两个应用程序中,正常的链接(如-)都正确打开,但当我在leopard开发的应用程序中尝试一个链接(如-,(注意:此链接返回一个图形)时,它会导致崩溃。在SnowLeopard中开发的应用程序适用于所有类型的链接
有人能告诉我它的原因和解决方法吗
堆栈跟踪如下所示:
0 0x928252e6 in Debugger
1 0x1b7e8c15 in dyld_stub_sprintf
2 0x1b7e8ecf in NP_Initialize
3 0x90f0599f in -[WebNetscapePluginPackage _tryLoad]
4 0x90f054d7 in -[WebNetscapePluginPackage load]
5 0x90f0a8af in -[WebNetscapePluginDocumentView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:]
6 0x90ef41da in WebFrameLoaderClient::createPlugin
7 0x930bd908 in WebCore::FrameLoader::loadPlugin
8 0x936ae0da in WebCore::FrameLoader::requestObject
9 0x930bc409 in WebCore::RenderEmbeddedObject::updateWidget
10 0x92f32e65 in WebCore::FrameView::updateWidgets
11 0x92f329c1 in WebCore::FrameView::performPostLayoutTasks
12 0x92f22e33 in WebCore::FrameView::layout
13 0x9306f72b in WebCore::Timer<WebCore::FrameView>::fired
14 0x92f9e94e in WebCore::ThreadTimers::sharedTimerFiredInternal
15 0x92f9e822 in WebCore::ThreadTimers::sharedTimerFired
16 0x93860624 in WebCore::timerFired
17 0x9621a70b in __CFRunLoopRun
18 0x96218094 in CFRunLoopRunSpecific
19 0x96217ec1 in CFRunLoopRunInMode
20 0x96e48f9c in RunCurrentEventLoopInMode
21 0x96e48d51 in ReceiveNextEventCommon
22 0x96e48bd6 in BlockUntilNextEventMatchingListInMode
23 0x902b0a89 in _DPSNextEvent
24 0x902b02ca in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
25 0x9027255b in -[NSApplication run]
26 0x9026a5ed in NSApplicationMain
27 0x000029ee in start at ESTableView.m:1278
调试器中的0 0x928252e6
1 0x1b7e8c15在动态存根中
NP_中的2 0x1b7e8ecf初始化
3 0x90f0599f in-[WebNetscapePluginPackage\u tryLoad]
4 0x90f054d7英寸-[WebNetscapePluginPackage加载]
5 0x90f0a8af在-[WebNetscapePluginDocumentView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:AttributeValue:loadManually:element:]
WebFrameLoaderClient::createPlugin中的6 0x90ef41da
WebCore::FrameLoader::loadPlugin中的7 0x930bd908
WebCore::FrameLoader::requestObject中的8 0x936ae0da
WebCore::RenderEmbeddedObject::updateWidget中的9 0x930bc409
WebCore::FrameView::updateWidgets中的10 0x92f32e65
WebCore::FrameView::performPostLayoutTasks中的11 0x92f329c1
WebCore::FrameView::layout中的12 0x92f22e33
WebCore中的13 0x9306f72b::计时器::已激发
WebCore中的14 0x92f9e94e::ThreadTimers::sharedTimerFiredInternal
WebCore::ThreadTimers::sharedTimerFired中的15 0x92f9e822
WebCore中的16 0x93860624::timerFired
17 0x9621a70b在\uuu CFRunLoopRun中
CFRunLoopRunSpecific中的18 0x96218094
19 0x96217ec1处于CFRUNLOOP运行模式
20 0x96e48f9c处于RunCurrentEventLoopInMode模式
21 0x96e48d51位于接收器NextEventCommon中
22 0x96e48bd6处于BlockUntilNextEventMatchingListInMode模式
23 0x902b0a89英寸\u dpsnextent
24 0x902b02ca in-[n应用程序下一个虚拟机任务:untilDate:inMode:dequeue:]
25 0x9027255b in-[n应用程序运行]
NSApplicationMain中的26 0x9026A5
27 0x000029ee在ESTableView启动。m:1278
我大胆猜测这不是你的错,而是早期版本WebKit的错。这一猜测的原因是什么
我发现每当它崩溃时,都会显示调用了msg:Debugger()。所以我检查了Xcode运行设置,发现选择了-Stop on Debugger()/DebugStr()。当我取消选择它并重新执行应用程序时,它工作正常,没有崩溃 是否有人可以验证关闭:Stop on Debugger()/DebugStr()不会导致任何问题 谢谢
Monaj光说它会导致崩溃是不够的。发布堆栈跟踪。此外,第一行(创建liveStreamLink的地方)完全没有必要。您可以直接在-URLWithString:…中传递[livestreamLinkTextField stringValue]。。。不必要的代码只会增加出错的机会。在保持可读性的同时尽可能简单。问题现在包含crashthanks的堆栈跟踪供您猜测。。。但这意味着。。。我不能做任何事情来解决它:(而且,正常的链接在这个应用程序中工作得很好…所以我真的很想知道为什么它会因为特定的链接而崩溃!