I have run into a rather odd problem, my app crashes if I try to run [webView loading]
!
The BOOL
is even declared in the docs, but it throws an exception when trying to access it.
This is really annoying, since without this BOOL
, I can't work out wether or not the webView
has really finished loading…
(running iOS 4.1)
EXCEPTION:
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 0x028开发者_开发百科a8354 ___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'
Caused by this little line:
if ([interwebz loading]){ /**/ }
From docs:
@property(nonatomic, readonly, getter=isLoading) BOOL loading
Use [webView isLoading]
Ah, right. There is no -loading method. There is an -isLoading method. The property name is called "loading". So if you're using the method call syntax, as you are, you would call [webView isLoading].
Note that the console says:
2010-11-05 22:14:24.151 MyApp[55671:207] -[UIWebView loading]: unrecognized selector sent to instance 0x764c5a0
精彩评论