当我尝试从表格视图到网页视图(对于youtube视频)执行segue时遇到错误。我为代码附加了代码,错误和控制台的目标输出。这似乎是WKWebView类的一个问题...但我没有得到任何与此相关的错误。
发信人:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let partyRock = partyRocks[indexPath.row]
performSegue(withIdentifier: "VideoVC", sender: partyRock)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let destination = segue.destination as? VideoVC {
if let party = sender as? PartyRock {
destination.partyRock = party
}
}
}
目的地:
import UIKit
class VideoVC: UIViewController {
@IBOutlet weak var webView: UIWebView!
@IBOutlet weak var titleLbl: UILabel!
private var _partyRock: PartyRock!
var partyRock: PartyRock {
get {
return _partyRock
} set {
_partyRock = newValue
}
}
override func viewDidLoad() {
super.viewDidLoad()
titleLbl.text = partyRock.videoTitle
webView.loadHTMLString(partyRock.videoURL, baseURL: nil)
}
}
控制台输出:
2017-08-18 13:33:10.460227+0300 TableViews-YoutubeVideo[49329:7366415] [BoringSSL] Function boringssl_context_get_peer_sct_list: line 1739 received sct extension length is less than sct data length
2017-08-18 13:33:16.756971+0300 TableViews-YoutubeVideo[49329:7366015] *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named WKWebView'
*** First throw call stack:
(
0 CoreFoundation 0x000000010fbc626b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010c324f41 objc_exception_throw + 48
2 CoreFoundation 0x000000010fc3aba5 +[NSException raise:format:] + 197
3 UIKit 0x000000010cfae7cc UINibDecoderDecodeObjectForValue + 323
4 UIKit 0x000000010cfaeae7 UINibDecoderDecodeObjectForValue + 1118
5 UIKit 0x000000010cfae67e -[UINibDecoder decodeObjectForKey:] + 89
6 UIKit 0x000000010c99041f -[UIView initWithCoder:] + 969
7 UIKit 0x000000010cfae949 UINibDecoderDecodeObjectForValue + 704
8 UIKit 0x000000010cfae67e -[UINibDecoder decodeObjectForKey:] + 89
9 UIKit 0x000000010cd631fb -[UIRuntimeConnection initWithCoder:] + 178
10 UIKit 0x000000010cfae949 UINibDecoderDecodeObjectForValue + 704
11 UIKit 0x000000010cfaeae7 UINibDecoderDecodeObjectForValue + 1118
12 UIKit 0x000000010cfae67e -[UINibDecoder decodeObjectForKey:] + 89
13 UIKit 0x000000010cd623f8 -[UINib instantiateWithOwner:options:] + 1262
14 UIKit 0x000000010ca8dd49 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
15 UIKit 0x000000010ca8e652 -[UIViewController loadView] + 177
16 UIKit 0x000000010ca8e983 -[UIViewController loadViewIfRequired] + 195
17 UIKit 0x000000010ca8f1e0 -[UIViewController view] + 27
18 UIKit 0x000000010d4e639d -[_UIFullscreenPresentationController _setPresentedViewController:] + 89
19 UIKit 0x000000010ca5fa8f -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
20 UIKit 0x000000010caa2338 -[UIViewController _presentViewController:withAnimationController:completion:] + 3808
21 UIKit 0x000000010caa514a __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 134
22 UIKit 0x000000010caa55ea -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532
23 UIKit 0x000000010caa5086 -[UIViewController presentViewController:animated:completion:] + 181
24 UIKit 0x000000010caaa487 -[UIViewController _showViewController:withAction:sender:] + 274
25 UIKit 0x000000010d0349a4 __66-[UIStoryboardShowSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 134
26 UIKit 0x000000010d1e8dcb -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 279
27 UIKit 0x000000010d1e8c83 -[UIStoryboardSegueTemplate _perform:] + 82
28 UIKit 0x000000010ca91bc4 -[UIViewController performSegueWithIdentifier:sender:] + 99
29 TableViews-YoutubeVideo 0x000000010ba025c1 _T023TableViews_YoutubeVideo6MainVCC9tableViewySo07UITableH0C_10Foundation9IndexPathV14didSelectRowAttF + 273
30 TableViews-YoutubeVideo 0x000000010ba0266c _T023TableViews_YoutubeVideo6MainVCC9tableViewySo07UITableH0C_10Foundation9IndexPathV14didSelectRowAttFTo + 92
31 UIKit 0x000000010ca2d603 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1810
32 UIKit 0x000000010ca2d81e -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 344
33 UIKit 0x000000010c900739 _runAfterCACommitDeferredBlocks + 318
34 UIKit 0x000000010c8eef81 _cleanUpAfterCAFlushAndRunDeferredBlocks + 280
35 UIKit 0x000000010c91f0d8 _afterCACommitHandler + 137
36 CoreFoundation 0x000000010fb68e57 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
37 CoreFoundation 0x000000010fb68dae __CFRunLoopDoObservers + 430
38 CoreFoundation 0x000000010fb4d3c4 __CFRunLoopRun + 1572
39 CoreFoundation 0x000000010fb4cb29 CFRunLoopRunSpecific + 409
40 GraphicsServices 0x00000001122589c6 GSEventRunModal + 62
41 UIKit 0x000000010c8f49a4 UIApplicationMain + 159
42 TableViews-YoutubeVideo 0x000000010ba06757 main + 55
43 libdyld.dylib 0x0000000110ce8621 start + 1
44 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)