Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any idea how to avoid this assertion in DDTokenCache and what it means?

I am using NSDataDetector with NSTextCheckingTypeLink to search a string for links (e.g. https://stackoverflow.com/questions) within it. Generally, it works fine, but when the string contains certain very long links (200+ chars) followed by a space and another word, I get this assertion:

> DDRequire failed: the following assertion will only be logged once >  > assertion on > /SourceCache/MobileDataDetectorsCore/MobileDataDetectorsCore-154/Sources/PushDown/DDTokenCache.c:310 > "delta >= 0" failed :Bad shift in > DDTokenCacheMoveStreamOffset, aborting 

This is the kind of text that causes this:

> blog.somethingorother.com/2011/storynameetcmorestuff/utm_source/eedburnerutmmediumfeedutmcampaign/FeedanutmcontentGooglFeedfetcherutmcampaign/FeedanutmcontentGooglFeedfetcher/eedburnerutm_mediumfeedutmcampaign/FeedanutmcontentGooglFeedfetcherutmcampaign HEY 

Does anyone know what's behind this or have any other insight into this?

like image 707
Jim Avatar asked Jan 21 '11 16:01

Jim


1 Answers

Resolved: Problem is with UITextView data detectors.

Please go through UIDataDetectorTypes:

typedef NS_OPTIONS(NSUInteger, UIDataDetectorTypes) { UIDataDetectorTypePhoneNumber   = 1 << 0,          // Phone number detection UIDataDetectorTypeLink          = 1 << 1,          // URL detection     #if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIDataDetectorTypeAddress       = 1 << 2,          // Street address detection UIDataDetectorTypeCalendarEvent = 1 << 3,          // Event detection #endif      UIDataDetectorTypeNone          = 0,               // No detection at all UIDataDetectorTypeAll           = NSUIntegerMax    // All types }; 

If you set UIDataDetectorTypeAll or UIDataDetectorTypeAddress or UIDataDetectorTypeCalendarEvent then iOS creates problems on iOS5.0 and Above.

textview.dataDetectorTypes=UIDataDetectorTypeAll;  

Or

textview.dataDetectorTypes=UIDataDetectorTypeAddress | UIDataDetectorTypeCalendarEvent;  

Then sometimes it creates problem on iOS5.0 and above.

So you need to set data detectors explicitly :

textview.dataDetectorTypes = UIDataDetectorTypeLink | UIDataDetectorTypePhoneNumber; 
like image 81
Gaurav Borole Avatar answered Oct 16 '22 14:10

Gaurav Borole