NSOperationQueue
обеспечить потоки, используемые для выполнения своих операций.
Создайте NSInvocationOperation
объектов и добавьте его в массив NSOperationQueue
.
NSInvocationOperation *insertOperationObject1 = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(insertMethod1) object:nil];
NSInvocationOperation *insertOperationObject2 = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(insertMethod2) object:nil];
NSInvocationOperation *insertOperationObject3 = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(insertMethod3) object:nil];
// добавление базы данных операций извлечения на NSOperationQueue
NSOperationQueue *m_opqInsertQueue = [[[NSOperationQueue alloc] init] autorelease];
[m_opqCustomerProfileDataFetchQueue setMaxConcurrentOperationCount:1];
[m_opqCustomerProfileDataFetchQueue addOperations:[NSArray arrayWithObjects:insertOperationObject1, insertOperationObject2, insertOperationObject3, nil] waitUntilFinished:NO];
ли это важно, если транзакция завершается до программа переходит? – borrrden
попробуйте lasy load technique .. даже с этим, если вы используете большую часть БД, это очевидно .. вы можете использовать NSUser по умолчанию несколько раз вместо этого – iMeMyself