yytextview 复制_按照yykit demon微博输入框那样集成yyTextView,一输入文字就奔溃

`- (void)insertText:(NSString *)text {

if (text.length == 0) return;

if (!NSEqualRanges(_lastTypeRange, _selectedTextRange.asRange)) {

[self _saveToUndoStack];

[self _resetRedoStack];

}

[self replaceRange:_selectedTextRange withText:text];

}`

一输入文字就进入这里,另外完整的call stack:* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[**NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'

* First throw call stack:

(

0 CoreFoundation 0x00000001132ffd85 __exceptionPreprocess + 165

1 libobjc.A.dylib 0x00000001129eddeb objc_exception_throw + 48

2 CoreFoundation 0x00000001131b8a52 -[__NSPlaceholderArray initWithObjects:count:] + 290

3 CoreFoundation 0x00000001132150b4 +[NSArray arrayWithObjects:count:] + 52

4 nihao 0x000000010c826e31 __53-[WBStatusComposeTextParser parseText:selectedRange:]_block_invoke + 481

5 libdispatch.dylib 0x0000000113ae83eb _dispatch_client_callout + 8

6 libdispatch.dylib 0x0000000113ad3d68 dispatch_once_f + 543

7 nihao 0x000000010c824bb8 -[WBStatusComposeTextParser parseText:selectedRange:] + 216

8 nihao 0x000000010c399a0b -[YYTextView _parseText] + 267

9 nihao 0x000000010c3ab6b4 -[YYTextView replaceRange:withText:] + 1988

10 nihao 0x000000010c3a93bd -[YYTextView insertText:] + 317

11 UIKit 0x0000000110edb9f8 -[UIKeyboardImpl insertText:] + 149

12 UIKit 0x0000000110ed815b -[UIKeyboardImpl performKeyboardOutput:] + 496

13 UIKit 0x0000000110ed7d48 __55-[UIKeyboardImpl handleKeyboardInput:executionContext:]_block_invoke_2 + 164

14 UIKit 0x00000001116682f3 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 345

15 Foundation 0x000000010f8197a7 __NSThreadPerformPerform + 283

16 CoreFoundation 0x0000000113225301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17

17 CoreFoundation 0x000000011321b22c __CFRunLoopDoSources0 + 556

18 CoreFoundation 0x000000011321a6e3 __CFRunLoopRun + 867

19 CoreFoundation 0x000000011321a0f8 CFRunLoopRunSpecific + 488

20 GraphicsServices 0x0000000114a71ad2 GSEventRunModal + 161

21 UIKit 0x0000000110c2df09 UIApplicationMain + 171

22 nihao 0x000000010c844eaf main + 111

23 libdyld.dylib 0x0000000113b1c92d start + 1

24 ??? 0x0000000000000001 0x0 + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

(lldb)

最后是崩溃在这里(系统的dispatch文件:once.h):#ifdef BLOCKS

__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)

DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW

void

dispatch_once(dispatch_once_t *predicate, dispatch_block_t block);

DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW

void

_dispatch_once(dispatch_once_t _predicate, dispatch_block_t block)

{

if (DISPATCH_EXPECT(_predicate, ~0l) != ~0l) {

dispatch_once(predicate, block);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值