gpt4 book ai didi

ipad - UIWebView 抛出 NSUnknownKeyException iPad

转载 作者:行者123 更新时间:2023-11-28 18:27:14 26 4
gpt4 key购买 nike

我有一个标签栏应用程序。一切正常,我可以在选项卡之间正常切换,除了当我切换到我的第二个选项卡 ProductViewClass 时, View 不会更新,它会在下面吐出控制台输出。除了 UIWebView 和 UILabel 之外,我在这个 View 中什么都没有。当我删除 UIWebView 它运行成功,当我添加另一个它仍然有效。只有当我将 IBOutlet 从我的文件所有者连接到 UIWebView 时,它才会停止工作。除了合成和发布productWebView之外,ProductWebView.m中唯一的非模板代码是这样的:

    NSString *urlString = @"http://www.google.com/";
NSURL *theURL = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:theURL];
[productWebView loadRequest:urlRequest];
NSLog(@"Google loaded");

ProductWebView.h的整体如下:

#import <UIKit/UIKit.h>
@interface ProductViewClass : UIViewController {

IBOutlet UIWebView *productWebView;
}

@property(nonatomic, retain) UIWebView *productWebView;
@end

这是控制台输出:

This GDB was configured as "x86_64-apple-darwin".Attaching to process 52523.
2011-01-30 19:18:28.907 FairCom[52523:40b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x4d06eb0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key productWebView.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00da8be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00efd5c2 objc_exception_throw + 47
2 CoreFoundation 0x00da8b21 -[NSException raise] + 17
3 Foundation 0x000296cf _NSSetUsingKeyValueSetter + 135
4 Foundation 0x0002963d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004a88d6 -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00d1f2cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004a72ed -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004a9081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x00361a94 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x0035f709 -[UIViewController loadView] + 120
11 UIKit 0x0035f5e3 -[UIViewController view] + 56
12 UIKit 0x00372230 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 120
13 UIKit 0x00370d86 -[UITabBarController transitionFromViewController:toViewController:] + 64
14 UIKit 0x00372b7e -[UITabBarController _setSelectedViewController:] + 263
15 UIKit 0x003729ed -[UITabBarController _tabBarItemClicked:] + 352
16 UIKit 0x002b1a6e -[UIApplication sendAction:to:from:forEvent:] + 119
17 UIKit 0x004af1f2 -[UITabBar _sendAction:withEvent:] + 422
18 UIKit 0x002b1a6e -[UIApplication sendAction:to:from:forEvent:] + 119
19 UIKit 0x003401b5 -[UIControl sendAction:to:forEvent:] + 67
20 UIKit 0x00342647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
21 UIKit 0x0034016c -[UIControl sendActionsForControlEvents:] + 49
22 UIKit 0x002b1a6e -[UIApplication sendAction:to:from:forEvent:] + 119
23 UIKit 0x003401b5 -[UIControl sendAction:to:forEvent:] + 67
24 UIKit 0x00342647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
25 UIKit 0x003411f4 -[UIControl touchesEnded:withEvent:] + 458
26 UIKit 0x002d60d1 -[UIWindow _sendTouchesForEvent:] + 567
27 UIKit 0x002b737a -[UIApplication sendEvent:] + 447
28 UIKit 0x002bc732 _UIApplicationHandleEvent + 7576
29 GraphicsServices 0x016dea36 PurpleEventCallback + 1550
30 CoreFoundation 0x00d8a064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
31 CoreFoundation 0x00cea6f7 __CFRunLoopDoSource1 + 215
32 CoreFoundation 0x00ce7983 __CFRunLoopRun + 979
33 CoreFoundation 0x00ce7240 CFRunLoopRunSpecific + 208
34 CoreFoundation 0x00ce7161 CFRunLoopRunInMode + 97
35 GraphicsServices 0x016dd268 GSEventRunModal + 217
36 GraphicsServices 0x016dd32d GSEventRun + 115
37 UIKit 0x002c042e UIApplicationMain + 1160
38 FairCom 0x00001be0 main + 102
39 FairCom 0x00001b71 start + 53
40 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
sharedlibrary apply-load-rules all
(gdb)

感谢您的帮助!

最佳答案

您正在加载 Nib 。在那个 Nib 中,你有一个名为 productWebView 的 socket 大概是连接到 WebView 。您看到的异常是告诉您 socket productWebView实际上并不存在。这就是它变得奇怪的地方。错误说对象 <UIViewController 0x4d06eb0>是缺少导出的那个。奇怪的是它说 UIViewController而不是实际 View Controller 子类的名称。听起来你有一个 nib,其中 File's Owner 被设置为你的 View Controller 子类之一,但在运行时你实际上只是使用 UIViewController 的一个实例。直接地。您应该验证所有代表选项卡栏 Controller 中选项卡的 View Controller 都是 UIViewController 的实际正确子类。而不仅仅是 UIViewController 的一个实例本身。

关于ipad - UIWebView 抛出 NSUnknownKeyException iPad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4847369/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com