objective c - Crash With iOS Private API Call -
this call:
[uikeyboardimpl(shortcutconversionsupport) _shortcutconversioncandidateforinput:] is crashing app. googling , looking through apple's api documentation brings no results. have never seen call being made anywhere in app. put break-point @ location believe getting called at. here crash report:
(fyi, crash log not symbolicated when using correct dsym file. no idea why)
last exception backtrace: 0 corefoundation 0x327e188f __exceptionpreprocess + 163 1 libobjc.a.dylib 0x34837259 objc_exception_throw + 33 2 corefoundation 0x327e1789 +[nsexception raise:format:] + 1 3 corefoundation 0x327e17ab +[nsexception raise:format:] + 35 4 corefoundation 0x3273bf5b -[__nscfstring substringwithrange:] + 103 5 buffer 0x000fa061 0xd6000 + 147553 6 uikit 0x32348137 -[uikeyboardimpl(shortcutconversionsupport) _shortcutconversioncandidateforinput:] + 615 7 uikit 0x32322c07 -[uikeyboardimpl addinputstring:fromvariantkey:] + 287 8 uikit 0x32322ae1 -[uikeyboardimpl handlestringinput:fromvariantkey:] + 165 9 uikit 0x32321829 -[uikeyboardimpl handlekeyevent:] + 1501 10 uikit 0x02b10261 0x2af4000 + 115297 11 uikit 0x324bb8a3 -[uikeyboardlayoutstar sendstringaction:forkey:ispopupvariant:] + 487 12 uikit 0x3231fdcd -[uikeyboardlayoutstar touchup:] + 3197 13 uikit 0x02b2ab47 0x2af4000 + 224071 14 uikit 0x3231f0fd -[uikeyboardlayout touchesended:withevent:] + 381 15 uikit 0x3222292b -[uiwindow _sendtouchesforevent:] + 319 16 uikit 0x32222319 -[uiwindow sendevent:] + 381 17 uikit 0x32208695 -[uiapplication sendevent:] + 357 18 uikit 0x32207f3b _uiapplicationhandleevent + 5827 19 graphicsservices 0x3188f22b purpleeventcallback + 883 20 corefoundation 0x327b5523 __cfrunloop_is_calling_out_to_a_source1_perform_function__ + 39 21 corefoundation 0x327b54c5 __cfrunloopdosource1 + 141 22 corefoundation 0x327b4313 __cfrunlooprun + 1371 23 corefoundation 0x327374a5 cfrunlooprunspecific + 301 24 corefoundation 0x3273736d cfrunloopruninmode + 105 25 graphicsservices 0x3188e439 gseventrunmodal + 137 26 uikit 0x32236cd5 uiapplicationmain + 1081 27 buffer 0x000d8327 0xd6000 + 8999 28 buffer 0x000d7dcc 0xd6000 + 7628 i understand crashing @ substringwithrange: when particular shortcutconversionsupport method called? believe me isolate issue.
this issue:
- (uitextrange *)textrangefromposition:(uitextposition *)fromposition toposition:(uitextposition *)toposition { // generate indexedposition instances wrap , ranges indexedposition *from = (indexedposition *)fromposition; indexedposition *to = (indexedposition *)toposition; nsrange range = nsmakerange(min(from.index, to.index), abs(to.index - from.index)); return [indexedrange rangewithnsrange:range]; } more specifically: abs(to.index - from.index)
the issue compiler thinks product of negation nsuinteger because to.index , from.index both nsuinteger variables (so value can never negative). therefore, if from.index > to.index value overflow producing value max size of 32 bit uint rather negative value. note, abs uses typeof determine return value of product. fix:
- (uitextrange *)textrangefromposition:(uitextposition *)fromposition toposition:(uitextposition *)toposition { indexedposition *from = (indexedposition *)fromposition; indexedposition *to = (indexedposition *)toposition; nsinteger index = to.index - from.index; nsrange range = nsmakerange(min(from.index, to.index), abs(index)); return [indexedrange rangewithnsrange:range]; } by way, only occurs when user has removed of shortcuts in settings > general > keyboard > shortcuts.
Comments
Post a Comment