将我的核心数据服务器同步到iOS

时间:2016-03-10 10:43:01

标签: ios objective-c core-data

当我同步我的核心数据时,我的应用程序崩溃的大部分时间。所以我能做些什么来解决这个崩溃点。这个APP_DELEGATE.managedObjectContext大部分时间都崩溃了。

    NSError *error = nil;
    if (![APP_DELEGATE.managedObjectContext save:&error])
    {
        NSLog(@"ERROR while saving UserList - %@", error);
    }
  

保存UserList时出错 - 错误域= NSCocoaErrorDomain Code = 134030"(null)" UserInfo = {NSAffectedObjectsErrorKey =("(entity:QuizOption; id:0x7fbe5dca67a0; data:{\ n optionText = Inferior; \ n questionId = 3; \ n socialIdOption = 12; \ n})"), NSUnderlyingException =无法更新从未插入的对象。}

2016-03-11 11:29:37.323 CuztomisePharma[1045:43638] *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSCFSet: 0x7fbe5dd43cf0> was mutated while being enumerated.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010a826e65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000109e4bdeb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010a8267c4 __NSFastEnumerationMutationHandler + 132
    3   CoreData                            0x0000000108ccba24 -[NSManagedObjectContext executeFetchRequest:error:] + 2932
    4   CuztomisePharma                     0x00000001089c5cea -[LoginManager getUserByUserId:] + 698
    5   CuztomisePharma                     0x00000001088746a1 -[SyncManager firstTimeSync] + 801
    6   CuztomisePharma                     0x00000001087e1399 -[LoginViewController loginServerCall] + 1273
    7   Foundation                          0x0000000109ad5dfb __NSThread__start__ + 1198
    8   libsystem_pthread.dylib             0x000000010d0f605a _pthread_body + 131
    9   libsystem_pthread.dylib             0x000000010d0f5fd7 _pthread_body + 0
    10  libsystem_pthread.dylib             0x000000010d0f33ed thread_start + 13
)

0 个答案:

没有答案