Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1233] iOS: Webview crashes on Twitter oAuth pin page (1.3.2)

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-07-25T12:17:54.000+0000
Affected Version/sRelease 1.5.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterJames Pearson
AssigneeNeeraj Gupta
Created2011-04-15T02:47:17.000+0000
Updated2012-07-26T22:26:00.000+0000

Description

First lets get some technical details out of the way:

  • Snow Leopard 10.6.4
  • Titanium Developer 1.2.1
  • Titanium SDK 1.3.2
  • iOS SDK 3.2 or 4.0

I discovered this bug trying to get oAuth working for Twitter. The bug occurs when the Allow / Deny page is submitted. You will briefly see the next page, with the authenication pin number, then the app will crash with the following error:

2010-07-06 10:23:56.850 iPadTest[7991:1803] *** -[DOMHTMLElement setHref:]: unrecognized selector sent to instance 0x6507cc0
[ERROR] The application has crashed with an unhandled exception. Stack trace:
0 CoreFoundation 0x0398d850 __exceptionPreprocess + 96
1 libobjc.A.dylib 0x03aa832c objc_exception_throw + 44
2 CoreFoundation 0x0398fa5b -[NSObject doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0390c676 ___forwarding___ + 918
4 CoreFoundation 0x0390b9f2 _CF_forwarding_prep_0 + 50
5 DataDetectorsUI 0x0c58c3d8 -[DOMDocument(DDExtension) dd_urlifyResults:operation:] + 3255
6 DataDetectorsUI 0x0c586cb8 -[DDDetectionController doURLificationOnWebThreadAndRelease:] + 543
7 CoreFoundation 0x0390ba5d __invoking___ + 29
8 CoreFoundation 0x0390b93a -[NSInvocation invoke] + 154
9 WebCore 0x040bf723 _ZL15HandleAPISourcePv + 147
10 CoreFoundation 0x038dce5a CFRunLoopRunSpecific + 1450
11 CoreFoundation 0x038dc8a8 CFRunLoopRunInMode + 88
12 WebCore 0x0404a633 _ZL12RunWebThreadPv + 467
13 libSystem.B.dylib 0x91fdb81d _pthread_start + 345
14 libSystem.B.dylib 0x91fdb6a2 thread_start + 34
2010-07-06 10:23:56.853 iPadTest[7991:1803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[DOMHTMLElement setHref:]: unrecognized selector sent to instance 0x6507cc0'
2010-07-06 10:23:56.854 iPadTest[7991:1803] Stack: (
60348496,
61506348,
60357211,
59819638,
59816434,
207143896,
207121592,
59816541,
59816250,
67893027,
59625050,
59623592,
67413555,
2449324061,
2449323682
)
terminate called after throwing an instance of 'NSException'
[INFO] Application has exited from Simulator

I have included the resources folder of an app that can replicate this problem.

Jim

Attachments

FileDateSize
resources.zip2011-04-15T02:47:17.000+000039237

Comments

  1. James Pearson 2011-04-15

    This also crashes in a build of 1.3.3, but the problem isn't (really) with Titanium, it is a bug in iOS4.

    The problem is with the WebView trying to recognise phone numbers, while we can'r fix this problem in iOS, we can work around it by adding an option to ignore phone numbers in a webview... unfortunately that is beyond me on Objective-C, but here is where I found the problem discussed:

    http://code.google.com/p/oauthconsumer-iphone/issues/detail?id=1&;can=1"> http://code.google.com/p/oauthconsumer-iphone/issues/detail?id=1&;am...

    And here is their implementation of a fix:

    http://code.google.com/p/oauthconsumer-iphone/source/diff?spec=svn10&;r=10&format=side&path=/trunk/examples/oauthTwitterApp/Classes/AuthorizeWebViewController.xib&old_path=/trunk/examples/oauthTwitterApp/Classes/AuthorizeWebViewController.xib&old=2"> http://code.google.com/p/oauthconsumer-iphone/source/diff?spec=svn1...

    Jim

  2. David R. 2011-04-15

    Hi Jeff,

    As a workaround in Titanium 1.3.x, it is possible to set the webview autoDetect to AUTODETECT_NONE:

                webView = Ti.UI.createWebView({
                   url: pUrl,
                   autoDetect:[Ti.UI.AUTODETECT_NONE]
               });
       
  3. Blain Hamon 2011-04-15

    We should revisit this, maybe fixed, but headache.

  4. Stephen Tramer 2011-04-15

    Yes! Let's revisit this!

  5. Stephen Tramer 2012-07-25

    Unable to reproduce in SDK 2.2.0.f9e938d, iPhone Sim 5.1.

JSON Source