简体   繁体   English

将设备升级到iOS 8.3后,我的应用程序冻结

[英]My app freeze after upgrading my device to iOS 8.3

I recently upgrade my device to iOS 8.3 from 8.1. 我最近将设备从8.1升级到了iOS 8.3。 my app worked fine on the device while it was set to version 8.1, but now after the upgrade it just freeze. 在将应用程序设置为版本8.1时,我的应用程序在该设备上可以正常运行,但现在在升级之后,它就冻结了。

I debugged and figure out when and why it freezes. 我调试并找出冻结的时间和原因。 I have 5 array's with capacity of 50 that each contains strings received from different places (ble,gps,video). 我有5个容量为50的数组,每个数组包含从不同位置(ble,gps,视频)接收的字符串。 when the NSArray reaches it capacity i write everything down to a file and remove all objects from the NSArray . NSArray达到其容量时,我将所有内容都写到一个文件中,并从NSArray删除所有对象。 I have a UIButton that when it's pressed i start collecting the data to the NSArray and write it to the files ->That's when it freeze! 我有一个UIButton ,当按下它时,我便开始将数据收集到NSArray并将其写入文件->那就是它冻结了!

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:fileName];

//check if file exisits, if not creates one.
if(![[NSFileManager defaultManager]fileExistsAtPath:filePath])
{

    [[NSFileManager defaultManager] createFileAtPath:filePath contents:nil attributes:nil];
}
//writes and adds data the content to the specifec file.
NSFileHandle *fileHandler = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
[fileHandler seekToEndOfFile];
[fileHandler writeData:[content dataUsingEncoding:NSUTF8StringEncoding]];
[fileHandler closeFile];

Any ideas why the upgrade version of the device have this affect on my app?? 为什么设备的升级版本会对我的应用产生影响?

EDIT: The console log seems to be still running (I have him printing in what function he is at the moment) although the device is frozen. 编辑:尽管设备被冻结,但控制台日志似乎仍在运行(我让他使用当前功能打印)。

正如Ashwin建议的那样,我将我的活动移至了后台线程,并且效果很好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM