2010-08-12 2 views
0

내가 만들고 정상 영구 저장소 사용 : 특별한 ..nothingiPhone과 iPad간에 핵심 데이터베이스를 복사 할 때 쓰기 오류가 발생하는 이유는 무엇입니까? 내 응용 프로그램에서

- (NSPersistentStoreCoordinator *) persistentStoreCoordinator { 
    // D_IN; 
    if (persistentStoreCoordinator != nil) { 
     return persistentStoreCoordinator; 
    } 
    persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]]; 

    // Allow inferred migration from the original version of the application. 
    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: 
          [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, 
          [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; 

    NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"Dances005.sqlite"]]; 




    NSError *error = nil; 

    if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl 
                 options:options error:&error]){ 
     NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 


    } 
    // D_OUT; 

    return persistentStoreCoordinator; 

합니다. 여기에는 iPhone 및 iPAD와 호환되는 모든 핵심 데이터가 포함 된 NSData 객체가 포함되어 있습니다.

iPhone에서 파일을 만들고 iPAD로 복사하려고합니다. iPAD에서 동일한 응용 프로그램을 열면 복사 된 sqlite가 사용되고/fetches가 읽히는 한 제대로 작동합니다. 최대한 빨리 데이터를 변경하고 나는 다음과 같은 오류 얻을 다시 저장할 필요가 같이

Unresolved error Error Domain=NSCocoaErrorDomain Code=256 UserInfo=0x6a2b7a0 "Operation could not be completed. (Cocoa error 256.)", { 
    NSFilePath = "/var/mobile/Applications/294B329D-D287-4012-A551-4E7348624225/Documents/Dances005.sqlite"; 
    NSUnderlyingException = error during SQL execution : attempt to write a readonly database; 

은 현재 내가 iPhoneExplorer을 사용하고 바로 아이폰에서 파일을 드래그 -> MAC -> 아이 패드를. iFile을 사용하여 rw Attributes를 확인했고 iPAD에서 사용자의 rw입니다. (iPhone과 동일)

무엇이 문제 일 수 있으며 어떻게 해결할 수 있습니까?

답변

1

iPhoneExplorer는 Apple에서 지원하지 않으며 "iPhone에서 파일 드래그하기 -> MAC -> iPAD"는 지원되지 않습니다. 파일을 iPad 응용 프로그램에 포함하려면 파일을 번들의 일부로 포함 시키거나 다른 메커니즘을 사용하여 파일을 전송하십시오.

+0

정확히. 타사 도구를 사용하지 않고 OS 3.2 이상에서 제공하는 iTunes를 통해 파일 공유 지원을 사용하십시오. 그러면 iTunes를 통해 파일을 응용 프로그램의 Documents 디렉토리로 드래그 할 수 있습니다. –

+0

조언을 주셔서 감사합니다. 좋은 생각입니다. 그러나 사용자가 파일을 먼저 교환 할 수있는 앱으로 앱을 등록하는 방법을 알아야합니다. 어떻게해야할지 모르겠다. 그동안 해결책을 찾았습니다! 파일 소유자를 확인하고 iFile을 사용하여 루트 대신 모바일로 설정하십시오. 이제 작동합니다. -> 테스트를위한 빠른 수정! – user387184

+0

그러면이 질문을 삭제해야합니다. –

관련 문제