【问题标题】:App crashes at [UIWebView loading]-call应用程序在 [UIWebView loading]-调用时崩溃
【发布时间】:2011-05-05 20:00:58
【问题描述】:

我遇到了一个相当奇怪的问题,如果我尝试运行 [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]){ /**/ }

【问题讨论】:

  • 你能粘贴异常吗?

标签: iphone objective-c xcode uiwebview ios4


【解决方案1】:

啊,对了。没有加载方法。有一个 -isLoading 方法。属性名称称为“加载”。因此,如果您使用方法调用语法,就像您一样,您将调用 [webView isLoading]。

请注意,控制台显示:

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

【讨论】:

    【解决方案2】:

    来自文档:

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

    使用[webView isLoading]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多