代码之家  ›  专栏  ›  技术社区  ›  Emil

应用程序在[UIWebView loading]调用时崩溃

  •  0
  • Emil  · 技术社区  · 14 年前

    [webView loading] !

    这个 BOOL

    这真烦人,因为没有这个 布尔 ,我不知道是不是 webView

    (运行iOS4.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 回复  |  直到 14 年前
        1
  •  1
  •   Ryan    14 年前

    啊,对。没有加载方法。有一个-isLoading方法。属性名称为“loading”。因此,如果您使用的是方法调用语法,那么您将调用[webView isLoading]。

    注意,控制台显示:

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

        2
  •  2
  •   Yuras    14 年前

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

    使用 [webView isLoading]