Why doesn't webFrameLoadDelegate protocol work?

I am just starting out at Xcode, and I'm trying to make a OS X web browser.

I want to figure out when my webview is loading and when it isn't. I've already looked at a lot of pages both from here and the Apple Developer Library on this, and this is what I get:

- (void)webViewDidStartLoad:(WebView *)webView {
    //enter code here  
}

And of course I also saw the webViewDidFinishLoad void, but when I try this in my AppDelegate.m nothing happens. I have connected the webview's frameLoadDelegate to the App Delegate and from what I understand, I also need to use the <> protocols in the AppDelegate.h file. My problem is that when I type in webFrameLoadDelegateProtocol into the <>s it tell me that webFrameLoadDelegateProtocol doesn't exist.

Answers


My problem is that when I type in "webFrameLoadDelegateProtocol" into the "<>"s it tell me that "webFrameLoadDelegateProtocol" doesn't exist.

WebFrameLoadDelegate Protocol is an informal protocol. It is not eligible for adoption in the same way. Omit <webFrameLoadDelegateProtocol> from your class's @interface.

when I try this in my AppDelegate.m nothing happens. I have connected the webview's frameLoadDelegate to the App Delegate

When do you set the web view's frameLoadDelegate property to be your app delegate?


It appears to be because you haven't set the webView delegate. You do not need to add the protocol to your header though. Instead you need to add this code somewhere, I suggest in applicationDidFinishLaunching

[webView setFrameLoadDelegate:self];

Then you can override the methods. If that doesn't work, then make sure you have connected your webView from the header to the webView in your IB. Also be sure to synthesize the webView in the .m.

Finally, you could use my open source example for an OS X browser. It is under the MIT license, so you can use it freely.

https://github.com/JosiahOne/basic_cocoa_web_browser

EDIT

I just realized, you are using the wrong method for Cocoa. Use these methods instead.

-(void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
{
    //Did start Load
}

-(void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
{
    //Did finish Load
}

Need Your Help

How to detect the status of msbuild from command line or c#

c# msbuild process exit-code

i am writing up a checkout, build and deployment application in c# and need to know the best way to detect whether my call to msbuild has succeeded or not. i have tried to use the error code from the

pyparsing: grammar for list of Dictionaries (erlang)

python parsing erlang pyparsing

I'm trying to build a grammar to parse an Erlang tagged tuple list, and map this to a Dict in pyparsing. I'm having problems when I have a list of Dicts. The grammar works if the Dict has just one

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.