2015-07-03 5 views
-2

Я получаю этот сбой при добавлении модели объекта в базе данных, я symbolicated аварии,Почему мой крах приложения IOS при сохранении модели объекта managedObjectContext

здесь трассировки стека для аварии

SIGSEGV SEGV_MAPERR

libobjc.A.dylib 0x366746ba objc_retain + 8 фонд 0x2907887d _encodeObject + 1066 фонд 0x29079a6f - [NSKeyedArchiver _encodeArrayOfObjects: forKey:] + 400 Фонд 0x2907a051 - [NSArray (NSArray) encodeWithCoder:] + 182 фонд 0x2907887d _encodeObject + 1066 MyApp 0x000d3da3 - [WorkOrder encodeWithCoder:] (WorkOrder.m: 97) фонд 0x2907887d _encodeObject + 1066 Фонд 0x2907ebd9 + [NSKeyedArchiver archivedDataWithRootObject:] + 154 CoreData 0x2809c861 - [NSSQLiteConnection выполнить]тысяча семьсот шестьдесят-два9
CoreData 0x280d99af - [NSSQLiteConnection updateRow:] + 544 CoreFoundation 0x283a8965 ____NSDictionaryEnumerate_block_invoke421 + 22 CoreFoundation 0x282b8740 CFBasicHashApply + 118 CoreFoundation 0x283a6367 __NSDictionaryEnumerate + 268 CoreData 0x2816bdf3 - [NSSQLCore writeChanges] + 544 CoreData 0x280d493d - [NSSQLCore saveChanges:] + 854 CoreD ата 0x280a2b25 - [NSSQLCore ExecuteRequest: withContext: ошибка:] + 734 CoreData 0x28154a35 __65- [NSPersistentStoreCoordinator ExecuteRequest: withContext: ошибка:] _ block_invoke + 3622 CoreData 0x2815ca13 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 260 libdispatch.dylib 0x36bc52cf _dispatch_client_callout + 20 libdispatch.dylib 0x36bcca3d _dispatch_barrier_sync_f_invoke + 46 CoreData 0x2814ef8d _perform + 134 CoreData 0x 280a2703 - [NSPersistentStoreCoordinator ExecuteRequest: withContext: ошибка:] + 312 CoreData 0x280c47d1 - [NSManagedObjectContext сохранить:] + 854 MyApp 0x0011f83f __37- [WorkOrderManagement saveWorkOrder:] _ block_invoke (WorkOrderManagement.m: 96) libdispatch.dylib 0x36bc52e3 _dispatch_call_block_and_release + 8 libdispatch.dylib 0x36bcf381 _dispatch_root_queue_drain + 1386 libdispatch.dylib 0x36bd03c3 _dispatch_worker_thread3 + 92 libsystem_pthread.dylib 0x36d2cdc1 _pthread_wqthread + 666 libsystem_pthread.dylib 0x36d2cb14 start_wqthread + 6

Вот мой код. После того, как было обнаружено, что подозрительная линия сбоя находится здесь, в этом кодовом блоке
[coder encodeObject: self.lstSelectedEmployees forKey: @ "lstSelectedEmployees"];

любая помощь будет очень признательна.

-(void) encodeWithCoder:(NSCoder *)coder { 
     [coder encodeObject:self.workOrderID forKey:@"workOrderID"]; 
     [coder encodeObject:self.projectID forKey:@"projectID"]; 
     [coder encodeObject:self.locationID forKey:@"locationID"]; 
     [coder encodeObject:self.service forKey:@"service"]; 
     [coder encodeObject:self.suggestedQty forKey:@"suggestedQty"]; 
     [coder encodeObject:self.note forKey:@"note"]; 
     [coder encodeInt:self.appDuration forKey:@"appDuration"]; 
     [coder encodeObject:self.forDate forKey:@"forDate"]; 
     [coder encodeObject:self.quantity forKey:@"quantity"]; 
     [coder encodeObject:self.lstPictures forKey:@"lstPictures"]; 
     [coder encodeObject:self.lstAudios forKey:@"lstAudios"]; 
     [coder encodeObject:self.startTime forKey:@"startTime"]; 
     [coder encodeObject:self.endTime forKey:@"endTime"]; 
     [coder encodeObject:self.comments forKey:@"comments"]; 
     [coder encodeObject:self.assignedToEmployeeName forKey:@"assignedToEmployeeName"]; 
     [coder encodeBool:self.isDone forKey:@"isDone"]; 
     [coder encodeBool:self.isPartial forKey:@"isPartial"]; 
     [coder encodeObject:self.lstSelectedEmployees forKey:@"lstSelectedEmployees"]; 
     [coder encodeObject:self.lstSelectedEquipment forKey:@"lstSelectedEquipment"]; 
     [coder encodeObject:self.lstSelectedMaterials forKey:@"lstSelectedMaterials"]; 
     [coder encodeObject:self.selectedVehicle forKey:@"selectedVehicle"]; 
     [coder encodeInt:self.qtySelectedIndex forKey:@"qtySelectedIndex"]; 
     [coder encodeInteger:self.elapsedCount forKey:@"elapsedCount"]; 
     [coder encodeBool:self.counterRunning forKey:@"counterRunning"]; 
     [coder encodeObject:self.lstEmployees forKey:@"lstEmployees"]; 
     [coder encodeObject:self.lstEquipment forKey:@"lstEquipment"]; 
     [coder encodeObject:self.lstChecklist forKey:@"lstChecklist"]; 
     [coder encodeBool:self.locationChecklistAdded forKey:@"locationChecklistAdded"]; 
     [coder encodeObject:self.scaleValue forKey:@"scaleValue"]; 
     [coder encodeObject:self.lstChecklistitems forKey:@"lstChecklistitems"]; 
} 

ответ

0

последнего объект, который будет закодирован до аварии является NSArray, убедитесь, что объекты в этом массиве разрешены типам списков свойства

+0

self.lstSelectedEmployees является NSMutableArray объектов Employee, –

+0

как сделать уверены, что объекты в массиве позволяют использовать типы свойств? –

+0

Основными допустимыми типами являются NSString, NSNumber, NSDate, NSData и типы коллекций NSArray и NSDictionary, которые также должны содержать типы, совместимые со списком свойств. Пользовательские типы должны быть закодированы с помощью encodeWithCoder и заархивированы с помощью NSKeyedArchiver – vadian