Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include WebView in Objective C without crashing

When I include a WebView component on a form in my Objective C project in XCode7 for a Cocoa application on OSX and try to compile, it compiles and then has a runtime error of:

NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (WebView) for key (NS.objects); the class may be defined in source code or a library that is not linked

What's the fix?

like image 832
Volomike Avatar asked Nov 30 '15 10:11

Volomike


1 Answers

In XCode7, if you use a WebView widget, you have to add the framework. Go to the Project Navigator and click the first icon, which is your project icon. In the middle of your screen on that IDE then, you'll see General > Linked Frameworks and Libraries. Click the + and add WebKit.framework. Now when you compile, the linkage will be there and it will work.

The drawback I think is that it says it's a 10.11 component, and so if I want to deploy my app to a 10.9 system or 10.10 system, it won't work. I'm not 100% certain of this without testing, however, but do have this hunch.

ADDENDUM:

I set my project to be 10.8 compliant and then found I can run just fine on 10.8 all the way to the latest OSX.

like image 165
Volomike Avatar answered Oct 13 '22 16:10

Volomike