Ok, so I launched an app last week before iOS8 came out. Everything was working fine in iOS7 and below. But now since people have updated to iOS8 my app is pausing/crashing for no reason.
I came to terms that it is when I set an NSMutableArray to the NSUserDefaults, it pauses.
Please note, the NSMutableArray is an array of NSStrings.
BUT (this is weird) if I breakpoint skip through the code it works and I get no pause.
Here is the function that it is blowing up...
-(void)UpdateMyAgenda:(NSString*)SessionID Remove:(BOOL)Remove{
if(!Remove){
//Do not Remove
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
_MyAgenda = [[NSMutableArray alloc]init];
_MyAgenda = [prefs mutableArrayValueForKey:@"MyAgenda"];
[_MyAgenda addObject:SessionID];
[prefs setObject:_MyAgenda forKey:@"MyAgenda"];
[prefs synchronize];
}else{
//Remove
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
_MyAgenda = [[NSMutableArray alloc]init];
_MyAgenda = [prefs mutableArrayValueForKey:@"MyAgenda"];
[_MyAgenda removeObject:SessionID];
[prefs setObject:_MyAgenda forKey:@"MyAgenda"];
[prefs synchronize];
}
for (NSString *item in _MyAgenda) {
NSLog(@"%@", item);
}
NSLog(@"-----------");
}