I have been having issues with the app crawling to a hault. After much agony, I was able to narrow the cause down to this: Core Data generates an invalid SQL statement and Core Data disconnect from SQL DB, then tries to recover only to fail again. The invalid SQL statement that caused the connection to end is:
CoreData: sql: SELECT Z_PK, Z_ENT, ZNODEID, ZALBUMID FROM ZNODE WHERE (ZNODEID IN (? , ? , ? ) OR (ZALBUMID IN (? , ? , ? ))Please note the extra "
(" before ZALBUMID. Either that or we can remove open parenthesis before ZNODEID and it will work.The error I am getting is:
2016-08-05 23:24:25.858 STV[31710:5515735] CoreData: annotation: Disconnecting from sqlite database due to an error.
2016-08-05 23:24:25.859 STV[31710:5515735] CoreData: error: (1) I/O error for database at /Users/skim/Library/Developer/CoreSimulator/Devices/E4B4DE09-F416-4792-AD35-550A38EAF6E2/data/Containers/Shared/AppGroup/FA274416-D266-41D3-84C1-D6AAE22D76F8/Library/Caches/STV.sqlite. SQLite error code:1, 'near ")": syntax error'
2016-08-05 23:24:25.860 STV[31710:5515735] CoreData: annotation: Connecting to sqlite databaite"
These series of events cause the app to crawl to a hault. I was hoping someone at Apple had a suggestion as to how I can avoid this error (workaround) until it is fixed. Deadline looms and I really do need this fixed. I would really appreciate anyone's help on this. Thanks!
FYI: Some background information.
Node an abstract entity which concrete entities Album and Folder entities inherit from. There are no predicates in my code that attempts to fetch nodeID and albumID using nodeID IN (%@) OR albumID IN (%@) syntax. I do believe this is generated by Core Data in maintaining related entities.