Closed Glavin001 closed 10 years ago
Wrap the calls to the SLSerializer
in the SLStore
for the following methods:
Causes error:
2014-08-22 01:06:04.855 xctest[37710:622b] SLModel initWithId: 53a72ded2fb05c0788546193 inContext: <NSManagedObjectContext: 0x10022adb0>
2014-08-22 01:06:04.838 xctest[37710:303] *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSCFSet: 0x10022af70> was mutated while being enumerated.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff84b0e25c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8d81ae75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff84b0db64 __NSFastEnumerationMutationHandler + 164
3 CoreData 0x00007fff892fc474 -[NSManagedObjectContext executeFetchRequest:error:] + 2644
4 Streamlyne-Mac-SDK 0x000000010074f7a2 __67+[NSManagedObject(MagicalRecord) MR_executeFetchRequest:inContext:]_block_invoke + 66
5 CoreData 0x00007fff89345cfe developerSubmittedBlockToNSManagedObjectContextPerform + 94
6 libdispatch.dylib 0x00007fff871b128d _dispatch_client_callout + 8
7 libdispatch.dylib 0x00007fff871b9b66 _dispatch_barrier_sync_f_slow_invoke + 46
8 libdispatch.dylib 0x00007fff871b128d _dispatch_client_callout + 8
9 libdispatch.dylib 0x00007fff871b8ef0 _dispatch_main_queue_callback_4CF + 333
10 CoreFoundation 0x00007fff84a754f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
11 CoreFoundation 0x00007fff84a30714 __CFRunLoopRun + 1636
12 CoreFoundation 0x00007fff84a2fe75 CFRunLoopRunSpecific + 309
13 Foundation 0x00007fff8c333adc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 253
14 Streamlyne-Mac-SDKTests 0x00000001000d9750 -[Streamlyne_iOS_SDKTests testFindAllAssets] + 689
15 CoreFoundation 0x00007fff849f99ac __invoking___ + 140
16 CoreFoundation 0x00007fff849f9814 -[NSInvocation invoke] + 308
17 XCTest 0x0000000100586a19 -[XCTestCase invokeTest] + 164
18 XCTest 0x0000000100586b08 -[XCTestCase performTest:] + 90
19 XCTest 0x00000001005878a0 -[XCTest run] + 65
20 XCTest 0x00000001005862b5 -[XCTestSuite performTest:] + 129
21 XCTest 0x00000001005878a0 -[XCTest run] + 65
22 XCTest 0x00000001005862b5 -[XCTestSuite performTest:] + 129
23 XCTest 0x00000001005878a0 -[XCTest run] + 65
24 XCTest 0x00000001005862b5 -[XCTestSuite performTest:] + 129
25 XCTest 0x00000001005878a0 -[XCTest run] + 65
26 XCTest 0x0000000100588fec +[XCTestProbe runTests:] + 138
27 xctest 0x000000010000112b xctest + 4395
28 xctest 0x0000000100001492 xctest + 5266
29 xctest 0x0000000100000e53 xctest + 3667
30 libdyld.dylib 0x00007fff87cbe5fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Make sure that any [self push:...]
like calls are on the main queue.
Before the testFindAllAssets
finished in 20
, 19
, and 25
seconds.
With the above it finished in 16.223
seconds. Will need to do more testing :).
The intention of this is not really to increase performance, but to offload heavy functions from the main queue thread, that blocks UI. Hopefully this helps the iOS app.
See http://stackoverflow.com/a/16283719