Jon Farmer
Jon Farmer

Reputation: 326

Core Data Swift - Not Creating SQLite file

I am new to Core Data and have followed a few tutorials. However I don't seem to be able to access the .sqlite file either on the simulator or on my iPhone 6. The debugger prints the following. Can anyone provide any assistance please?

2015-07-17 11:31:28.006 Rockford[390:32594] CoreData: error: (1) I/O error for database at /var/mobile/Containers/Data/Application/D2A80335-E681-4194-944D-CAE66F80EFA6/Documents/Rockford.sqlite. SQLite error code:1, 'unknown database ZROCKFORD'
2015-07-17 11:31:28.011 Rockford[390:32594] CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///var/mobile/Containers/Data/Application/D2A80335-E681-4194-944D-CAE66F80EFA6/Documents/Rockford.sqlite options:{ NSInferMappingModelAutomaticallyOption = 1; NSMigratePersistentStoresAutomaticallyOption = 1; } ... returned error Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x170460a40 {NSSQLiteErrorDomain=1, NSUnderlyingException=I/O error for database at /var/mobile/Containers/Data/Application/D2A80335-E681-4194-944D-CAE66F80EFA6/Documents/Rockford.sqlite. SQLite error code:1, 'unknown database ZROCKFORD'} with userInfo dictionary { NSSQLiteErrorDomain = 1; NSUnderlyingException = "I/O error for database at /var/mobile/Containers/Data/Application/D2A80335-E681-4194-944D-CAE66F80EFA6/Documents/Rockford.sqlite. SQLite error code:1, 'unknown database ZROCKFORD'";

Upvotes: 2

Views: 2071

Answers (1)

Mohammed Janish
Mohammed Janish

Reputation: 207

Just delete the App from the simulator/device and run it again. It may happen when you make some changes in core data part of your project and the device have the previously created database.

Upvotes: 1

Related Questions