Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

harry65

macrumors member
Original poster
Aug 26, 2008
36
0
I'm trying to use a WebView object to display a web page, but my program ends up crashing (The Debugger has exited due to signal 2 (SIGINT)) while the page is loading. Here's what my .h and .m files look like...

Code:
#import <Cocoa/Cocoa.h>
#import <WebKit/WebView.h>


@interface AppController : NSObject {
	IBOutlet WebView *webView;
}

- (IBAction)setupView:(id)sender;

@end

Code:
#import "AppController.h"

@implementation AppController

- (id)init
{
	[super init];
	webView = [[WebView alloc] init];
	return self;
}

- (IBAction)setupView:(id)sender
{
	NSString *urlString = @"http://www.nba.com";
//	NSString *urlString = @"http://google.com";
	[webView setMainFrameURL:urlString];
}

@end

My UI consists of a window with a scrollView in it, and a WebView inside the scroll view. I also have a single button that will call 'setupView' when clicked, and my program crashes when I try and load something like nba.com. If I try to load google.com, though, it works fine.

I ran this in the debugger and put a breakpoint at the 'setMainFrameURL' line. When I get there and 'continue', the program crashes and gives me this message:

Code:
(gdb) c
Continuing.
Current language:  auto; currently objective-c
=shlibs-removed,shlib-info=[num="101",name="JavaPluginCocoa",kind="B",dyld-addr="0x15eea000",reason="dyld",requested-state="E",state="E",path="/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Resources/JavaPluginCocoa.bundle/Contents/MacOS/JavaPluginCocoa",description="/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Resources/JavaPluginCocoa.bundle/Contents/MacOS/JavaPluginCocoa",loaded_addr="0x15eea000",slide="0x15eea000",prefix=""]
Debugger() was called!
(gdb)

I have added the WebKit.framework and JavaVM.framework into my project, but I still get the error above.

I checked, and the /System/Library/Fr..../JavaPluginCocoa file does exist on my machine.

Another funny thing I don't quite understand... If I run this in the debugger with the breakpoint described above, hit 'c' at the breakpoint, I get the message above. The debugger is now at the '(gdb)' prompt, and if I hit 'c' again, I get the 'Continuing' message in the debugger and my page finishes loading and my program seems to work fine. However, whenever I run it without debugging, it will crash.

Anybody know what I'm doing wrong here? Any help would be greatly appreciated.

Thanks.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Not sure about the crash, but why are you recreating the webview? That is unneeded since the nib creates it for you.
 

harry65

macrumors member
Original poster
Aug 26, 2008
36
0
Thanks kainjow. I'm fairly new to ObjC/Cocoa/Xcode/etc. and am still figuring out IB and so forth. I appreciate the feedback.

However, I took out the constructor and my program still crashes. I assume it has something to do with Java in the page I am loading (since something like google.com works fine), but I'm not sure what I need to add to my project to fix this. Or, is it something like what LD_LIBRARY_PATH does on Linux? I'm not sure if OS X has an equivalent, or if I even need something like that.

I'm wondering if this would work on someone else's machine or if it's something weird with my setup... Any takers?

Any other ides?

Thanks.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
You could disable plugins in the WebView (there's a checkbox in IB for that) and see if that helps.
 

harry65

macrumors member
Original poster
Aug 26, 2008
36
0
Thanks again. Disabling the plugins helped - my program no longer crashes. Though, the web page does not load fully (I get a message about needing to download the Flash player). Not sure what exactly this tells me... :confused:
 

dleber

macrumors newbie
Jul 6, 2009
2
0
This is a known issue. You can blame Adobe. There is a call to Debugger() in the Flash 10 (and it's been there a while).

There is a blog post here that outlines the workaround.
 

harry65

macrumors member
Original poster
Aug 26, 2008
36
0
This is a known issue. You can blame Adobe. There is a call to Debugger() in the Flash 10 (and it's been there a while).

There is a blog post here that outlines the workaround.

Thanks dleber!! I'll definitely have to check that out when I get a chance. I've since abandoned the little example I was working on but I'm curious now to see if turning off the debug stuff would work.

[edit]
Works just as advertised now... Thanks!!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.