应用程序在[UIWebView加载] -call崩溃

时间:2010-11-05 21:01:29

标签: iphone objective-c xcode uiwebview ios4

我遇到了一个相当奇怪的问题,如果我尝试运行[webView loading]我的应用程序崩溃了!

BOOL甚至在文档中声明,但在尝试访问它时会抛出异常。

这真的很烦人,因为如果没有这个BOOL,我就无法解决,webView真的已经完成了加载...

(运行iOS 4.1)

例外:

2010-11-05 22:14:23.808 MyApp[55671:207] Started Download..
2010-11-05 22:14:24.151 MyApp[55671:207] -[UIWebView loading]: unrecognized selector sent to instance 0x764c5a0
2010-11-05 22:14:24.153 MyApp[55671:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWebView loading]: unrecognized selector sent to instance 0x764c5a0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x02936b99 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x02a8640e objc_exception_throw + 47
    2   CoreFoundation                      0x029386ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x028a82b6 ___forwarding___ + 966
    4   CoreFoundation                      0x028a7e72 _CF_forwarding_prep_0 + 50
    5   MyApp                               0x00037aec -[Browser webViewDidFinishLoad:] + 53
    6   UIKit                               0x0893bf29 -[UIWebViewAccessibility(SafeCategory) webView:didFinishLoadForFrame:] + 69
    7   CoreFoundation                      0x028a75cd __invoking___ + 29
    8   CoreFoundation                      0x028a74a1 -[NSInvocation invoke] + 145
    9   CoreFoundation                      0x028d4ba8 -[NSInvocation invokeWithTarget:] + 72
    10  CoreFoundation                      0x028a8354 ___forwarding___ + 1124
    11  CoreFoundation                      0x028a7e72 _CF_forwarding_prep_0 + 50
    12  CoreFoundation                      0x028a75cd __invoking___ + 29
    13  CoreFoundation                      0x028a74a1 -[NSInvocation invoke] + 145
    14  WebCore                             0x03282cb0 _ZL20HandleDelegateSourcePv + 64
    15  CoreFoundation                      0x02917faf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    16  CoreFoundation                      0x0287639b __CFRunLoopDoSources0 + 571
    17  CoreFoundation                      0x02875896 __CFRunLoopRun + 470
    18  CoreFoundation                      0x02875350 CFRunLoopRunSpecific + 208
    19  CoreFoundation                      0x02875271 CFRunLoopRunInMode + 97
    20  GraphicsServices                    0x02ffd00c GSEventRunModal + 217
    21  GraphicsServices                    0x02ffd0d1 GSEventRun + 115
    22  UIKit                               0x00377af2 UIApplicationMain + 1160
    23  MyApp                               0x00002634 main + 102
    24  MyApp                               0x000025c5 start + 53
)
terminate called after throwing an instance of 'NSException'

由这条小线引起:

if ([interwebz loading]){ /**/ }

2 个答案:

答案 0 :(得分:2)

来自docs:

@property(nonatomic, readonly, getter=isLoading) BOOL loading

使用[webView isLoading]

答案 1 :(得分:1)

啊,对。有无加载方法。有一个-isLoading方法。属性名称称为“加载”。因此,如果您正在使用方法调用语法,则可以调用[webView isLoading]。

请注意,控制台说:

2010-11-05 22:14:24.151 MyApp [55671:207] - [UIWebView loading]:无法识别的选择器发送到实例0x764c5a0