Я только что выполнил миграцию ядра HeavyWeight - я не уверен, где грань между тяжелым и легким - это 5 сопоставлений и 1 пользовательский класс. Я, конечно, могу предоставить любой из них. Мне кажется, что, возможно, оно было успешным - мое приложение запускается, и оно полностью переходит к viewDidLoad - только тогда, когда оно пытается выполнить fetchRequest, в случае сбоя. Буду признателен за любую помощь в отладке следующего сообщения об ошибке. У меня есть несколько вопросов:
- Работала ли миграция? Любой способ узнать, сработало ли это, и является ли это проблемой с моим запросом на выборку, или каким-то образом данные были повреждены или вообще не работали. Каков наилучший способ проверить это?
- Почему в SQL так много вопросительных знаков - означает ли это, что миграция работает неправильно?
- Что такое Z? все атрибуты, кажется, начинаются с Z - "ГДЕ t0.ZNOTES НЕ НЕДОПУСТИМО, например"
- Что такое выражение NSSymbolicExpression? Где это произойдет при переносе основных данных. Я понимаю, что каким-то образом он пытается найти длину этого объекта, и у объекта нет этого метода экземпляра. Означает ли это, что предполагается, что миграция завершена, когда она, например, не была?
Информация о любом из вышеперечисленных будет принята с благодарностью - в том числе ресурсы, где можно найти / читать больше. Я пытался узнать о миграции в документации яблоки, но у меня возникли проблемы. Это было так старается ... что-нибудь помогает, спасибо :)
CoreData: annotation: Connecting to sqlite database file at "/Users/alexmarshall/Library/Developer/CoreSimulator/Devices/252E29AE-83C0-4063-8000-C4302854B529/data/Containers/Data/Application/2AC9D1D5-AA70-4236-B9C5-E5C711C4AF28/Library/Application Support/SweatNetOffline.sqlite"
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_METADATA'
CoreData: sql: pragma recursive_triggers=1
CoreData: sql: pragma journal_mode=wal
CoreData: sql: SELECT Z_VERSION, Z_UUID, Z_PLIST FROM Z_METADATA
CoreData: annotation: Connecting to sqlite database file at "/Users/alexmarshall/Library/Developer/CoreSimulator/Devices/252E29AE-83C0-4063-8000-C4302854B529/data/Containers/Data/Application/2AC9D1D5-AA70-4236-B9C5-E5C711C4AF28/Library/Application Support/SweatNetOffline.sqlite"
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_METADATA'
CoreData: sql: SELECT Z_VERSION, Z_UUID, Z_PLIST FROM Z_METADATA
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_METADATA'
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'ACHANGE'
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'ATRANSACTIONSTRING'
CoreData: annotation: Connecting to sqlite database file at "/Users/alexmarshall/Library/Developer/CoreSimulator/Devices/252E29AE-83C0-4063-8000-C4302854B529/data/Containers/Data/Application/2AC9D1D5-AA70-4236-B9C5-E5C711C4AF28/Library/Application Support/.SweatNetOffline.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3"
CoreData: annotation: creating schema.
CoreData: sql: pragma page_size=4096
CoreData: sql: pragma auto_vacuum=2
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_METADATA'
CoreData: sql: CREATE TABLE ZRECORD ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZRECORDTYPE INTEGER, ZSKILL INTEGER, ZTIMESTAMP TIMESTAMP, ZIMAGEFILENAME VARCHAR, ZTEXT VARCHAR, ZTHUMBNAILFILENAME VARCHAR, ZVIDEOFILENAME VARCHAR )
CoreData: sql: CREATE TABLE ZSKILL ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZMETADATA INTEGER, ZNAME VARCHAR )
CoreData: sql: CREATE TABLE ZSKILLMETADATA ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZDIFFICULTY INTEGER, ZISACTIVE INTEGER, ZSKILL INTEGER, ZLATESTUPDATE TIMESTAMP, ZSECTIONIDENTIFIER VARCHAR, ZTHUMBNAIL BLOB )
CoreData: sql: CREATE INDEX IF NOT EXISTS ZRECORD_ZSKILL_INDEX ON ZRECORD (ZSKILL)
CoreData: sql: CREATE INDEX IF NOT EXISTS ZRECORD_Z_ENT_INDEX ON ZRECORD (Z_ENT)
CoreData: sql: CREATE INDEX IF NOT EXISTS ZSKILL_ZMETADATA_INDEX ON ZSKILL (ZMETADATA)
CoreData: sql: CREATE INDEX IF NOT EXISTS ZSKILLMETADATA_ZSKILL_INDEX ON ZSKILLMETADATA (ZSKILL)
CoreData: annotation: Creating primary key table.
CoreData: sql: CREATE TABLE Z_PRIMARYKEY (Z_ENT INTEGER PRIMARY KEY, Z_NAME VARCHAR, Z_SUPER INTEGER, Z_MAX INTEGER)
CoreData: sql: INSERT INTO Z_PRIMARYKEY(Z_ENT, Z_NAME, Z_SUPER, Z_MAX) VALUES(1, 'Record', 0, 0)
CoreData: sql: INSERT INTO Z_PRIMARYKEY(Z_ENT, Z_NAME, Z_SUPER, Z_MAX) VALUES(2, 'ImageRecord', 1, 0)
CoreData: sql: INSERT INTO Z_PRIMARYKEY(Z_ENT, Z_NAME, Z_SUPER, Z_MAX) VALUES(3, 'TextRecord', 1, 0)
CoreData: sql: INSERT INTO Z_PRIMARYKEY(Z_ENT, Z_NAME, Z_SUPER, Z_MAX) VALUES(4, 'VideoRecord', 1, 0)
CoreData: sql: INSERT INTO Z_PRIMARYKEY(Z_ENT, Z_NAME, Z_SUPER, Z_MAX) VALUES(5, 'Skill', 0, 0)
CoreData: sql: INSERT INTO Z_PRIMARYKEY(Z_ENT, Z_NAME, Z_SUPER, Z_MAX) VALUES(6, 'SkillMetaData', 0, 0)
CoreData: sql: CREATE TABLE Z_METADATA (Z_VERSION INTEGER PRIMARY KEY, Z_UUID VARCHAR(255), Z_PLIST BLOB)
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_METADATA'
CoreData: sql: DELETE FROM Z_METADATA WHERE Z_VERSION = ?
CoreData: sql: INSERT INTO Z_METADATA (Z_VERSION, Z_UUID, Z_PLIST) VALUES (?, ?, ?)
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_MODELCACHE'
CoreData: sql: CREATE TABLE Z_MODELCACHE (Z_CONTENT BLOB)
CoreData: sql: INSERT INTO Z_MODELCACHE (Z_CONTENT) VALUES (?)
CoreData: sql: COMMIT
CoreData: sql: pragma recursive_triggers=1
CoreData: sql: pragma journal_mode
CoreData: sql: SELECT Z_VERSION, Z_UUID, Z_PLIST FROM Z_METADATA
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_METADATA'
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_MODELCACHE'
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'ACHANGE'
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'ATRANSACTIONSTRING'
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_METADATA'
CoreData: sql: DELETE FROM Z_METADATA WHERE Z_VERSION = ?
CoreData: sql: INSERT INTO Z_METADATA (Z_VERSION, Z_UUID, Z_PLIST) VALUES (?, ?, ?)
CoreData: sql: COMMIT
CoreData: sql: pragma page_count
CoreData: annotation: sql execution time: 0.0002s
CoreData: sql: pragma freelist_count
CoreData: annotation: sql execution time: 0.0001s
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZLATESTUPDATE, t0.ZNAME, t0.ZUUID FROM ZTAG t0
CoreData: annotation: sql connection fetch time: 0.0004s
CoreData: annotation: total fetch execution time: 0.0008s for 1 rows.
CoreData: sql: SELECT t0.Z_ENT, t0.Z_PK, Z_FOK_1POSTS FROM ZPOST t0 JOIN Z_1TAGS t1 ON t0.Z_PK = t1.Z_1POSTS WHERE t1.Z_2TAGS = ?
CoreData: annotation: sql connection fetch time: 0.0005s
CoreData: annotation: total fetch execution time: 0.0006s for 1 rows.
CoreData: annotation: to-many relationship fault "posts" for objectID 0x9de26d27ef2a7aca <x-coredata://DDA9D961-398D-4C5C-8DAA-919F17139695/Tag/p1> fulfilled from database. Got 1 rows
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZISVIDEO, t0.ZMEDIAFILENAME, t0.ZNOTES, t0.ZPOSTIMAGE, t0.ZTIMESTAMP FROM ZPOST t0 WHERE t0.Z_PK = ?
CoreData: annotation: sql connection fetch time: 0.0001s
CoreData: annotation: total fetch execution time: 0.0002s for 1 rows.
CoreData: annotation: fault fulfilled from database for : 0x9de26d27ef2a7ac8 <x-coredata://DDA9D961-398D-4C5C-8DAA-919F17139695/Post/p1>
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: SELECT Z_MAX FROM Z_PRIMARYKEY WHERE Z_ENT = ?
CoreData: sql: UPDATE OR FAIL Z_PRIMARYKEY SET Z_MAX = ? WHERE Z_ENT = ? AND Z_MAX = ?
CoreData: sql: COMMIT
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: INSERT INTO ZSKILLMETADATA(Z_PK, Z_ENT, Z_OPT, ZSKILL, ZDIFFICULTY, ZISACTIVE, ZLATESTUPDATE, ZSECTIONIDENTIFIER, ZTHUMBNAIL) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)
CoreData: sql: COMMIT
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZISVIDEO, t0.ZMEDIAFILENAME, t0.ZNOTES, t0.ZPOSTIMAGE, t0.ZTIMESTAMP FROM ZPOST t0 WHERE t0.ZNOTES IS NOT NULL
CoreData: annotation: sql connection fetch time: 0.0001s
CoreData: annotation: total fetch execution time: 0.0002s for 0 rows.
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZISVIDEO, t0.ZMEDIAFILENAME, t0.ZNOTES, t0.ZPOSTIMAGE, t0.ZTIMESTAMP FROM ZPOST t0 WHERE ( t0.ZISVIDEO IS NOT NULL AND t0.ZISVIDEO = ?)
CoreData: annotation: sql connection fetch time: 0.0001s
CoreData: annotation: total fetch execution time: 0.0002s for 1 rows.
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: COMMIT
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: INSERT INTO ZRECORD(Z_PK, Z_ENT, Z_OPT, ZSKILL, ZRECORDTYPE, ZTIMESTAMP, ZIMAGEFILENAME) VALUES(?, ?, ?, ?, ?, ?, ?)
CoreData: sql: COMMIT
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZISVIDEO, t0.ZMEDIAFILENAME, t0.ZNOTES, t0.ZPOSTIMAGE, t0.ZTIMESTAMP FROM ZPOST t0 WHERE ( t0.ZISVIDEO IS NOT NULL AND t0.ZISVIDEO = ?)
CoreData: annotation: sql connection fetch time: 0.0001s
CoreData: annotation: total fetch execution time: 0.0002s for 0 rows.
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE OR FAIL ZSKILLMETADATA SET Z_OPT = ? WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: COMMIT
CoreData: sql: SELECT t0.Z_ENT, t0.Z_PK, Z_FOK_2TAGS FROM ZTAG t0 JOIN Z_1TAGS t1 ON t0.Z_PK = t1.Z_2TAGS WHERE t1.Z_1POSTS = ?
CoreData: annotation: sql connection fetch time: 0.0001s
CoreData: annotation: total fetch execution time: 0.0001s for 1 rows.
CoreData: annotation: to-many relationship fault "tags" for objectID 0x9de26d27ef2a7ac8 <x-coredata://DDA9D961-398D-4C5C-8DAA-919F17139695/Post/p1> fulfilled from database. Got 1 rows
2020-04-16 10:34:32.587088-0700 SweatNetOffline[33644:4324282] -[NSSymbolicExpression length]: unrecognized selector sent to instance 0x60000315f820
CoreData: annotation: Disconnecting from sqlite database.
CoreData: annotation: Disconnecting from sqlite database.
CoreData: annotation: Disconnecting from sqlite database.
2020-04-16 10:34:32.619490-0700 SweatNetOffline[33644:4324282] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSSymbolicExpression length]: unrecognized selector sent to instance 0x60000315f820'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23c75c4c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
5 Foundation 0x00007fff257159b4 -[NSOrderedSet(NSKeyValueCoding) valueForKeyPath:] + 53
6 Foundation 0x00007fff257fea18 -[NSFunctionExpression expressionValueWithObject:context:] + 707
7 Foundation 0x00007fff257fe935 -[NSFunctionExpression expressionValueWithObject:context:] + 480
8 CoreData 0x00007fff238aa500 -[NSEntityMigrationPolicy createRelationshipsForDestinationInstance:entityMapping:manager:error:] + 1272
9 CoreData 0x00007fff238f5a98 -[NSMigrationManager(InternalMethods) _doSecondPassForMapping:error:] + 418
10 CoreData 0x00007fff238f6c00 -[NSMigrationManager(InternalMethods) _migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:] + 2012
11 CoreData 0x00007fff238f3c9f -[NSMigrationManager migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:] + 664
12 CoreData 0x00007fff239a5eab -[NSStoreMigrationPolicy(InternalMethods) migrateStoreAtURL:toURL:storeType:options:withManager:error:] + 254
13 CoreData 0x00007fff239a5466 -[NSStoreMigrationPolicy migrateStoreAtURL:withManager:metadata:options:error:] + 99
14 CoreData 0x00007fff239a6adf -[NSStoreMigrationPolicy(InternalMethods) _gatherDataAndPerformMigration:] + 2829
15 CoreData 0x00007fff238fc335 __91-[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:]_block_invoke + 2469
16 CoreData 0x00007fff2390ceb9 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 177
17 libdispatch.dylib 0x0000000110c5ed48 _dispatch_client_callout + 8
18 libdispatch.dylib 0x0000000110c6d9bf _dispatch_lane_barrier_sync_invoke_and_complete + 132
19 CoreData 0x00007fff238f88f9 _perform + 181
20 CoreData 0x00007fff237e9334 -[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:] + 416
21 CoreData 0x00007fff238fb31b -[NSPersistentStoreCoordinator _doAddPersistentStoreWithDescription:privateCopy:completeOnMainThread:withHandler:] + 515
22 CoreData 0x00007fff238fb8ab -[NSPersistentStoreCoordinator addPersistentStoreWithDescription:completionHandler:] + 205
23 CoreData 0x00007fff238aef63 -[NSPersistentContainer _loadStoreDescriptons:withCompletionHandler:] + 272
24 CoreData 0x00007fff238aee2c -[NSPersistentContainer loadPersistentStoresWithCompletionHandler:] + 398
25 SweatNetOffline 0x000000010fa9dc05 $s15SweatNetOffline11AppDelegateC19persistentContainerSo012NSPersistentG0CvgAFyXEfU_ + 181
26 SweatNetOffline 0x000000010fa9da97 $s15SweatNetOffline11AppDelegateC19persistentContainerSo012NSPersistentG0Cvg + 375
27 SweatNetOffline 0x000000010fae8788 $s15SweatNetOffline19Home2ViewControllerC019skillFetchedResultsF033_A1FE4BA766270B7DD28F222CBF923E7DLLSo09NSFetchediF0CyAA13SkillMetaDataCGvgAJyXEfU_ + 360
28 SweatNetOffline 0x000000010fae5497 $s15SweatNetOffline19Home2ViewControllerC019skillFetchedResultsF033_A1FE4BA766270B7DD28F222CBF923E7DLLSo09NSFetchediF0CyAA13SkillMetaDataCGvg + 375
29 SweatNetOffline 0x000000010fae5771 $s15SweatNetOffline19Home2ViewControllerC11viewDidLoadyyF + 177
30 SweatNetOffline 0x000000010fae5c1b $s15SweatNetOffline19Home2ViewControllerC11viewDidLoadyyFTo + 43
31 UIKitCore 0x00007fff47a0ef01 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 83
32 UIKitCore 0x00007fff47a13e5a -[UIViewController loadViewIfRequired] + 1084
33 UIKitCore 0x00007fff479781e4 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 160
34 UIKitCore 0x00007fff479784e8 -[UINavigationController _startTransition:fromViewController:toViewController:] + 144
35 UIKitCore 0x00007fff479793b6 -[UINavigationController _startDeferredTransitionIfNeeded:] + 868
36 UIKitCore 0x00007fff4797a721 -[UINavigationController __viewWillLayoutSubviews] + 150
37 UIKitCore 0x00007fff4795b553 -[UILayoutContainerView layoutSubviews] + 217
38 UIKitCore 0x00007fff485784bd -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478
39 QuartzCore 0x00007fff2b131db1 -[CALayer layoutSublayers] + 255
40 QuartzCore 0x00007fff2b137fa3 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 517
41 QuartzCore 0x00007fff2b1438da _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 80
42 QuartzCore 0x00007fff2b08a848 _ZN2CA7Context18commit_transactionEPNS_11TransactionEd + 324
43 QuartzCore 0x00007fff2b0bfb51 _ZN2CA11Transaction6commitEv + 643
44 UIKitCore 0x00007fff480aa575 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 81
45 CoreFoundation 0x00007fff23bd429c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
46 CoreFoundation 0x00007fff23bd3a08 __CFRunLoopDoBlocks + 312
47 CoreFoundation 0x00007fff23bce894 __CFRunLoopRun + 1284
48 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438
49 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65
50 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621
51 SweatNetOffline 0x000000010fa9ea7b main + 75
52 libdyld.dylib 0x00007fff5227ec25 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)