简体   繁体   中英

My app freeze after upgrading my device to iOS 8.3

I recently upgrade my device to iOS 8.3 from 8.1. my app worked fine on the device while it was set to version 8.1, but now after the upgrade it just freeze.

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). when the NSArray reaches it capacity i write everything down to a file and remove all objects from the 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!

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建议的那样,我将我的活动移至了后台线程,并且效果很好!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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