Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Question about adding the WebView Framework to a Xamarin.Mac project

$
0
0

My application uses Google OAuth security: I need the user to authorize my application (with Google) before I issue certain WebClient calls.

Thus, I need to get a browser window visible and wait for the user to land at a certain URL before continuing. After my code detects they've landed at a certain URL, I have to parse the URL for a substring. It's all been done before using .NET and the embedded browser control in System.Forms.

I am having difficulty implementing embedded WebView for Mac. I have figured out, mostly, how to do it with GTK, but I think I prefer to go with an XIB based approach.

After I create an XIB based dialog, here are the steps that I follow.

I double click on the XIB file and xcode Interface Builder is launched.
I drag a WebView onto the dialog.
I open the Controller.h file.
I control+drag WebView into the "Assistant Editor" to create an outlet so that I can capture it's documented-loaded event.
This may or may not be "OnFinishedLoading". In the .NET WebBrowser control, it would be "Navigated".

Most of the time, it doesn't recognize WebView and emits an error.
Sometimes during my experimentation, as described below, it doesn't emit an error, but it quickly comes back.

Having researched this kind of problem on the internet, I came to realize I needed to add Webkit.Framework to the project.
There seems to be two ways to do this, but I'll describe the most obvious way.
In the project Navigator, expand to Frameworks and right click and choose Add Files to ...
For me, on Mountain Lion, the path to find the Framework is:
Macintosh HD:System:Frameworks:WebKit.framework which, btw, is a folder.
I tried selecting various files in that folder, but the folder seems to be the correct choice that xcode IB wants.

Anyway, so now I have the framework added to the project.
I seem to have no way to save the project with this change.
If I make another change, I can save the controller .h file, but not the project.

Thus, when I return to Monodevelop (Xamarin.Mac paid version), the additional Framework being referenced by the project gets lost.
Later, when I go back into Interface Builder, it's gone and I would have to re-add it every time.
I don't see where to make a similar change in Xamarin.Mac.
There are no crashes, I just do not get the document completed event, probably because the Framework reference is absent, although it could be a wrong signature on the event handler.

If there is an easy way to do what I'm trying to do, I'm all ears.
If I have picked the wrong approach, please tell me.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>