dadidoe
Computer Pro :)
Hi,
I'm working on a browser and it needs automatic http:// substitution. However, whenever I click on go, the whole URL gets replaced with either a 0 or a 1. Not very useful. I can't find the issue here. Can someone help out?
Here is my .h file:
Here's the troublesome bit: (i get no errors or warning for this btw)
I'm working on a browser and it needs automatic http:// substitution. However, whenever I click on go, the whole URL gets replaced with either a 0 or a 1. Not very useful. I can't find the issue here. Can someone help out?

Here is my .h file:
Code:
#import <Cocoa/Cocoa.h>
@class WebView;
@interface MyDocument : NSDocument
{
IBOutlet WebView *webView;
IBOutlet NSTextField *textField;
IBOutlet NSWindow *window;
IBOutlet NSButton *backButton;
IBOutlet NSButton *forwardButton;
IBOutlet NSProgressIndicator *progressIndicator;
NSString *docTitle;
NSString *frameStatus;
NSString *resourceStatus;
NSString *url;
NSURL *URLToLoad;
int resourceCount;
int resourceFailedCount;
int resourceCompletedCount;
}
- (IBAction)connectURL:(id)sender;
- (void)setFrameStatus: (NSString *)s;
- (void)setResourceStatus: (NSString *)s;
- (void)goToHistoryItem:(id)historyItem;
@end
Here's the troublesome bit: (i get no errors or warning for this btw)
Code:
- (IBAction)connectURL:(id)sender
{
NSString *url2 = [sender stringValue];
if (![url2 hasPrefix:@"http://"])
URLToLoad = [NSString stringWithFormat:@"http://%@", url2];
[textField setStringValue:url2];
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url2]]];
}