Group Group Group Group Group Group Group Group Group

Your First iOS App - Part 43: Web Views and | Ray Wenderlich Videos

#1

Learn how to add web views into your apps to display web pages, and learn how to use Xcode's developer documentation in your day-to-day development.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5993-your-first-ios-app/lessons/43
#2

I am working on the WebViews video and I cannot get the build to show correctly. I have checked and double-checked the code but once I build it succeeds but clicking the info button freezes the button and brings me back to Xcode to show an error. “Thread 1: signal SIGABRT”

Any ideas?

#3

@srluman Have you tried comparing your project against the downloadable solution?

#4

Hello!
My webView does seem to load correctly, but on the console I get some error messages after a while. The app keeps working, though. Any ideas? Thanks in advance!

Xcode 10.0 beta 6

**2018-08-20 11:49:57.627876+0200 BullsEye[12959:1161577] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service**

**2018-08-20 11:49:57.630839+0200 BullsEye[12959:1161577] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service**
#5

@rwenderlich yep. I even tried copying the code directly into my XCode project and it still crashed when clicking on (or tapping on the phone) the info button to the “About” page.

#6

@srluman Are you sure you’re downloading the solution from here?

I just downloaded the solution from that button and tried it with the latest version of Xcode (Xcode 10 beta 6) and it runs OK for me:

Please give that a shot - sometimes it’s useful to compare your project with a “known good / working version” like this.

If you’re having troubles with your project when you click on the About button, I’m betting it’s one of two things:

  1. Perhaps the About button Touch Up Inside action is not connected to a proper outlet. Double check that in your connections inspector.
  2. Perhaps you haven’t added BullsEye to your project (or made sure that BullsEye is checked in Target Membership).

I hope that helps, good luck!

#7

if i download from there and run your project it works fine but in comparing and even in copying directly from your project into mine I continue to get the same error. See screen shot for initial error. Pasting the additional code from AppDelegate below

**2018-08-21 15:22:13.787339-0400 BullsEye[2154:995972] [Accessibility] ****************** Loading GAX Client Bundle ******************

2018-08-21 15:22:15.672627-0400 BullsEye[2154:995972] Unknown class _TtC8BullsEye35About_View_ControllerViewController in Interface Builder file.

2018-08-21 15:22:15.753796-0400 BullsEye[2154:995972] *** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: '[<UIViewController 0x137a009f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key webView.'

***** First throw call stack:**

(0x1e38c7ef8 0x1e2a95a40 0x1e37dfdcc 0x1e426d57c 0x21067cbb4 0x21037d924 0x1e37afb98 0x2102a39f4 0x21068382c 0x2106841d8 0x2106844a0 0x210684c0c 0x2108c4bf4 0x2102f27b8 0x2106960f4 0x210699008 0x21069966c 0x210698f60 0x21069929c 0x210473d98 0x2104763f8 0x2104762a4 0x210476570 0x20ffc3bd8 0x2100e89f4 0x2100e8d14 0x2100e7d14 0x2107600f8 0x21076135c 0x20ffddcbc 0x20ff1984c 0x20ff1c2b8 0x20ff14e4c 0x1e38565b8 0x1e3856538 0x1e3855e1c 0x1e3850ce8 0x1e38505b8 0x1e5ac0584 0x20ffc24c4 0x100778da0 0x1e3310c0c)

libc++abi.dylib: terminating with uncaught exception of type NSException

(lldb)

Any help is greatly appreciated.

#8

Looking at the error, I noticed this:

" Unknown class _TtC8BullsEye35About_View_ControllerViewController in Interface Builder file.

That makes me wonder if there’s a mismatch between the class name for your view controller, and what you have configured in the Storyboard editor.

I’d recommend selecting your about view controller in the storyboard editor, looking at what class name it is set to in the identity inspector, and make sure it matches to the name of the class inside your AboutViewController.swift file.

If you’re still having issues, feel free to zip up the entire project folder and send it to me so I can take a peek: ray@raywenderlich.com.

#9

I encountered a similar error. I had missed the step where you hold down the control key and drag from the About View Controller yellow circle to the WebView. In other words, I had not connected the
@IBOutlet weak var webView: WKWebView! to the AboutViewController.

Hope this helps someone else.

#10

Am really enjoying this course. However, I am also getting an error after having added the web view. It crashes with ‘Thread 1: signal SIGABRT’ I downloaded the project files from this page and opened the project in xcode to build. I see the same error I do in my own project. In the console it says:

*** Terminating app due to uncaught exception ‘NSInvalidUnarchiveOperationException’, reason: ‘Could not instantiate class named WKWebView because no class named WKWebView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)’

I am using xcode 10.2 (10E125).

It is possible that I missed an instruction in an earlier video, but the solution for me was to go to the General Project settings and add webkit.framework to the linked frameworks and libraries at the bottom of the tab

1 Like
#11

1.Go to general settings of your project.
2. Scroll down and find linked frameworks and libraries
3. Add webkit.framework

9 Likes
#12

gave the answer above

#13

I had the same error and had to manually add the webkit framework to my project. I followed this tutorial: http://docs.onemobilesdk.aol.com/ios-ad-sdk/adding-frameworks-xcode.html

1 Like
#14

Worked for me on Xcode Version 10.2 (10E125)
1.Go to general settings of your project.
2. Scroll down and find linked frameworks and libraries
3. Add webkit.framework

10 Likes
#15

Thank you norcorder. That made it work for me.

1 Like
#16

I had exactly the same error, and I solved it adding the webKit framework in the project options as somebody else explained.

*** Terminating app due to uncaught exception ‘NSInvalidUnarchiveOperationException’, reason: ‘Could not instantiate class named WKWebView because no class named WKWebView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)’

The strange thing is: without any framework linked in the general options if I set a breakpoint where the WKWebView is declared , pause and then I continue the normal execution the error disappears and the webView loads correctly. Maybe for some reason the app needs more time to load the WebKit library?:thinking:

#17

Thanks norcoder, adding webkit.framework works for me!

#18

Hi Ray and team,

Thanks for your work on this project. This introduction to iOS coding has been well put together, which allowed me to get through without a problem until Part43, as discussed in this thread. The fix regarding adding webkit into Linked Frameworks resolved the problem.

Is there any chance you can update the video or add some commentary to include this extra step ? I’d like to hear from you as to why this is required for Webkit and not UIkit and how it may be relevant in other cases.

#19

Hello Ray and fantastic team,

Great courses, thank you so much for free weekend at [http://raywenderlich.com ]!

In this application, with new update with Xcode, we just have to modify the code in order to work.

Two ways :sunny:

ONE : ( as norcoder said below)
Worked for me on Xcode Version 10.2 (10E125)
1.Go to general settings of your project.
2. Scroll down and find linked frameworks and libraries
3. Add webkit.framework

SECOND Way: add this code just before override func viewDidLoad()

override func loadView() {
webView = WKWebView()
webView.navigationDelegate = self
View = webView
}

I hope that helps thinking of different solution, good luck!

1 Like
#20

Hello Ray and fantastic team,

Great courses, thank you so much for free weekend at [http://raywenderlich.com ]!

In this application, with new update with Xcode, we just have to modify the code in order to work.

Two ways :sunny:

ONE : ( as norcoder said below)
Worked for me on Xcode Version 10.2 (10E125)
1.Go to general settings of your project.
2. Scroll down and find linked frameworks and libraries
3. Add webkit.framework

SECOND Way: add this code just before override func viewDidLoad()

override func loadView() {
webView = WKWebView()
webView.navigationDelegate = self
View = webView
}

I hope that helps thinking of different solution, good luck!