Show-message function got error: Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
following is the function.
-(void)showMeg:(NSString *)str { dispatch_sync(dispatch_get_main_queue(), ^{ [[[Memo1 textStorage] mutableString]appendString:[NSString stringWithFormat:@"%@", str]]; [Memo1 scrollRangeToVisible:NSMakeRange(Memo1.string.length, 0)];//auto scroll down }); }
I called it in other .m file like the following.
-(void)showMeg:(NSString *)str { dispatch_sync(dispatch_get_main_queue(), ^{ [[[Memo1 textStorage] mutableString]appendString:[NSString stringWithFormat:@"%@", str]]; [Memo1 scrollRangeToVisible:NSMakeRange(Memo1.string.length, 0)];//auto scroll down }); }