-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
多线程问题,有截图 #4
Comments
首先,感谢贡献这个代码的人,是你的辛勤汗水给我们开发了一个很不错的类库,节省了我们大量的时间和精力。然后,我发现了一个跟上面这位兄台一样的问题,我断点进去才发现原来这个对象不知道在哪里被释放了,由于这个resource这个类用的是单例对象,resource类本身不会在创建新的对象,所以导致这个_unicodeToHanyuPinyinTable对象一旦被释放就几乎是永远找不回来了(除非释放resource对象再创建新的对象),由于这个类用的是non-arc机制,所以后来我在_unicodeToHanyuPinyinTable这个类的初始化地方加了一个retain操作,就没有再报异常了,呵呵,虽然这个解决方案不一定好,但是总算可以跑起来了,分享给大家。对了,一定要记得在dealloc方法中吧_unicodeToHanyuPinyinTable这个释放,使用愉快😄 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
多个线程跑的时候,出现错误,不是每次都会出现.
截图如下:
方法里面出错.
(NSString *)getHanyuPinyinRecordFromCharWithChar:(unichar)ch {
int codePointOfChar = ch;
NSString *codepointHexStr =[[NSString stringWithFormat:@"%x", codePointOfChar] uppercaseString];
NSString *foundRecord =[self->_unicodeToHanyuPinyinTable objectForKey:codepointHexStr];
return [self isValidRecordWithNSString:foundRecord] ? foundRecord : nil;
}
The text was updated successfully, but these errors were encountered: