2012-04-09 10 views
2

私のアプリでアドレス帳を使用していますバックグラウンドスレッドでアドレス帳のデータを取得しています。 。次のエラーでアプリがクラッシュ:私のアプリがバックグラウンドから起動した後、私のアプリはUIApplicationDidBecomeActiveNotificationを受信したときApp AppName [5811]がロックされたシステムファイルで中断されました:AddressBook.sqlitedb "

Application Specific Information: 
[2786] was suspended with locked system files: 
/private/var/mobile/Library/AddressBook/AddressBook.sqlitedb 

、私はバックグラウンドスレッドでアドレス帳データを取得しています。ここに私のコードは

ある
// 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を持っています私のアプリの機能。 CALLの終了後に私のアプリケーション&からnoをseelctedすると私は再び私のアプリケーションがクラッシュする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"]; 
    } 
} 

どのようにクラッシュする問題を解決できますか?どのような助けも高く評価されます。ありがとう。

+0

解決策はまだ見つかりましたか? –

+0

いいえ、これは何も見つかりませんでした – iOSAppDev

答えて

0

は今では、私はこれはあなたがバックグラウンドに送られた後、アドレス帳にアクセスし続けるときに踏み台アプリを殺すだろうと思われるのiOS 6

に新しい安全策であると考えられるが分かりました。これは、ファイルをアップロードするためにバックグラウンドで実行し続ける場合に発生する可能性があります。

6.1でこの問題が解決されている可能性もあります。日本語や中国語のキーボードでも、同様の問題があります。これらのキーボードは、オートコンプリートを使用してグローバルデータベースにアクセスします。この問題は6.1で確実に修正されました。あなたの問題もなくなりました。

関連する問題