Recently I wrote an app to collect data from iPhone. However the app crashed after a random period of time which made my classmates sad. But finally, we found out where the bug is !!!!!
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flagDescription The parameter atomically, I set NO from the Internet. However, it crashed when multiple writes happened. So setting atomically YES is essential for multiple threads!!!!!!!!
解决iOS应用崩溃问题

本文介绍了一款用于从iPhone收集数据的应用程序,在经历随机时间后出现的崩溃问题。通过调试发现,当多个线程同时写入文件时,设置atomically参数为YES可以有效避免应用程序崩溃。
6292

被折叠的 条评论
为什么被折叠?



