Я использую AddressBook в своем приложении. Я извлекаю данные адресной книги в фоновом потоке. Если я открою свое приложение из фона, приложение падает с ошибкой при слежении:.Приложение с ошибкой AppName [5811] было приостановлено с заблокированными системными файлами: AddressBook.sqlitedb "
Application Specific Information:
[2786] was suspended with locked system files:
/private/var/mobile/Library/AddressBook/AddressBook.sqlitedb
После моего приложения запускается из фона, я извлечение адресной книги в фоновом потоке, когда мое приложение получить UIApplicationDidBecomeActiveNotification Вот мой код
// In my ViewController.m
- (void)viewDidLoad
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appLaunchedFromBackground:)
name:UIApplicationDidBecomeActiveNotification object:nil];
// Some more code
}
-(void)appLaunchedFromBackground:(NSNotification *) notification {
NSLog(@"In appLaunchedFromBackground");
[self performSelectorInBackground:@selector(getUpdatedAddressBookData) withObject:nil];
}
-(void)getUpdatedAddressBookData {
NSLog(@"In %s",__PRETTY_FUNCTION__);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
AddressBook *addBook = [[AddressBook alloc]init];
[addBook fetchAddressBookDataInBackground];
[addBook release];
[pool drain];
}
Также у меня есть ВЫЗОВ функциональность в моем приложении. Если я ПРИЗЫВАЮТ удалить из своего приложения & после завершения CALL, я снова запустил приложение для 2-х кратных сбоев приложения. Для CALL я использовал следующий код:
+(void)makeCallToSelectedContact:(NSString*)phoneNo{
NSMutableString *phoneNumber = [NSMutableString stringWithString:phoneNo];
[phoneNumber replaceOccurrencesOfString:@" "
withString:@""
options:NSLiteralSearch
range:NSMakeRange(0, [phoneNumber length])];
[phoneNumber replaceOccurrencesOfString:@"("
withString:@""
options:NSLiteralSearch
range:NSMakeRange(0, [phoneNumber length])];
[phoneNumber replaceOccurrencesOfString:@")"
withString:@""
options:NSLiteralSearch
range:NSMakeRange(0, [phoneNumber length])];
NSLog(@"phoneNumber => %@",phoneNumber);
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNumber]]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNumber]]];
}
else {
NSLog(@"Unable to open");
[self showAlertWithTitle:@"Alert" andMessage:@"This Device Doesn't Support Call Functionality"];
}
}
Как я могу решить проблему сбой? Любая помощь высоко ценится. Благодарю.
Вы нашли решение? –
Нет. Я ничего не нашел для этого – iOSAppDev