project-imas / encrypted-core-data

v2.0 - iOS Core Data encrypted SQLite store using SQLCipher
Other
785 stars 236 forks source link

Crash since recent push #271

Closed sschale closed 7 years ago

sschale commented 7 years ago

I get Encrypted Core Data by the way of cocoapods, using pod 'EncryptedCoreData', :git => 'https://github.com/project-imas/encrypted-core-data.git'.

I recently updated my pods, and when trying to initialize my database, it now crashes immediately.

It gives the error on this line of ECD setup:

- (void)setAttributes:(NSDictionary *)attributes ofItemAtURL:(NSURL *)url error:(NSError *__autoreleasing *)error {
    *****[self.configuration.fileManager setAttributes:attributes ofItemAtPath:[url copy] error:error];
}

I call it using Swift:

    let options: [NSObject : AnyObject] = [
      EncryptedStorePassphraseKey as NSObject : myKeyString as AnyObject,
      EncryptedStoreDatabaseLocation as NSObject : myModelURL as AnyObject,
      NSMigratePersistentStoresAutomaticallyOption as NSObject: true as AnyObject,
      NSInferMappingModelAutomaticallyOption as NSObject: true as AnyObject
    ]
    let myEncryptedStore = EncryptedStore.make(options: options, managedObjectModel: myObjectModel)

I've verified that I'm not passing any strings in, the URL I pass is shown as a URL in the debugger.

2017-03-18 16:07:02.958 ResidentAdvantage[34664:6005763] -[NSURL _fastCharacterContents]: unrecognized selector sent to instance 0x6080000a8160 2017-03-18 16:07:08.612 ResidentAdvantage[34664:6005763] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL _fastCharacterContents]: unrecognized selector sent to instance 0x6080000a8160' First throw call stack: ( 0 CoreFoundation 0x00000001116b1d4b exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000011098921e objc_exception_throw + 48 2 CoreFoundation 0x0000000111721f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 CoreFoundation 0x0000000111637005 __forwarding + 1013 4 CoreFoundation 0x0000000111636b88 _CF_forwarding_prep_0 + 120 5 CoreFoundation 0x00000001116f7787 _CFStringGetFileSystemRepresentationWithErrorStatus + 55 6 CoreFoundation 0x00000001115cd7eb CFStringGetFileSystemRepresentation + 11 7 Foundation 0x000000011044e701 -[NSFileManager getFileSystemRepresentation:maxLength:withPath:] + 65 8 Foundation 0x00000001104c12bb -[NSFileManager setAttributes:ofItemAtPath:error:] + 71 9 EncryptedCoreData 0x000000010ff8949c -[EncryptedStoreFileManager(FileManagerExtensions) setAttributes:ofItemAtURL:error:] + 204 10 EncryptedCoreData 0x000000010ff88f49 -[EncryptedStoreFileManager setupDatabaseWithOptions:error:] + 825 11 EncryptedCoreData 0x000000010ff898de +[EncryptedStore(Initialization) makeStoreWithOptions:managedObjectModel:error:] + 366 12 EncryptedCoreData 0x000000010ff8a29b +[EncryptedStore makeStoreWithOptions:managedObjectModel:] + 123 13 ResidentAdvantage 0x000000010f35a593 _TFC17ResidentAdvantage11AppDelegateP3355C35CD9B834E032683AC64CB197557C21setupCoreDataUsingKeyfSST + 1347 14 ResidentAdvantage 0x000000010f356d43 _TFC17ResidentAdvantage11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP__Sb + 2035 15 ResidentAdvantage 0x000000010f357a74 _TToFC17ResidentAdvantage11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 180 16 UIKit 0x00000001125953c2 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290 17 UIKit 0x0000000112596d47 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236 18 UIKit 0x000000011259d0ed -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731 19 UIKit 0x000000011259a26d -[UIApplication workspaceDidEndTransaction:] + 188 20 FrontBoardServices 0x0000000114c5d6cb FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24 21 FrontBoardServices 0x0000000114c5d544 -[FBSSerialQueue _performNext] + 189 22 FrontBoardServices 0x0000000114c5d8cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45 23 CoreFoundation 0x0000000111656761 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 24 CoreFoundation 0x000000011163b98c CFRunLoopDoSources0 + 556 25 CoreFoundation 0x000000011163ae76 __CFRunLoopRun + 918 26 CoreFoundation 0x000000011163a884 CFRunLoopRunSpecific + 420 27 UIKit 0x0000000112598aea -[UIApplication _run] + 434 28 UIKit 0x000000011259ec68 UIApplicationMain + 159 29 ResidentAdvantage 0x000000010f35f98f main + 111 30 libdyld.dylib 0x0000000116c2c68d start + 1 )

lolgear commented 7 years ago

@sschale could you try PR #270?

sschale commented 7 years ago

@lolgear That seems to fix the issue. (Not exhaustively tested) Thanks!

lolgear commented 7 years ago

@sschale closed?