3

I've created a very simple Mac program to load a web page. It works and loads it well but I can't run events! Nothing is logged!

#import "BenotaAppDelegate.h"
@implementation BenotaAppDelegate
@synthesize webViewIns;
@synthesize window;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    NSURL *url = [NSURL URLWithString:@"http://example.com"];
    NSURLRequest *req = [NSURLRequest requestWithURL:url];
    [[webViewIns mainFrame] loadRequest:req];
}

- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
    NSLog(@"didFinishLoadForFrame");
}
@end

I can not use delegate right....

3
  • 2
    Did you set a delegate for the web view?
    – jscs
    Feb 2, 2012 at 19:32
  • No :D I searched about delegating and protocols and will learn about them and then will back to this question. Do you know simple reference about it to start? developer.apple is not friendly for starters...
    – AHHP
    Feb 3, 2012 at 9:28
  • Protocol was used but nothing changed!
    – AHHP
    Feb 9, 2012 at 14:34

2 Answers 2

10

You need to set outlet frameLoadDelegatefrom your webView object to a class, that contains a method webView:didFinishLoadForFrame:

Connections inspector

0

Just a note that my (iOS) app was rejected due:

non-public API/s in your app: webView:didFinishLoadForFrame

You might want to reconsider your app, I definitely must find the 3rd party lib, which called that, and get rid of it. "It wasn't me!" is not a valid excuse :)

2
  • But this is a public API: developer.apple.com/library/mac/documentation/cocoa/Reference/…
    – Yoav
    Nov 4, 2013 at 8:23
  • Sorry I wasn't clear: my app was iOS, not OS X! That method doesn't seem to be public in iOS. It was used by a debugging framework, whose release notes especially said the framework must NOT be included in release. Next time I'll read instructions more carefully :)
    – JOM
    Nov 4, 2013 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.