【发布时间】:2013-11-26 11:38:47
【问题描述】:
使用共享实例我在执行过程中有时会崩溃。
崩溃可以重现,但绝不会以常规方式发生。使用 iOS 7.0 出现的此类崩溃在以前的 iOS 版本中正常工作。
欢迎帮助
2013-11-26 12:25:38.149 Publilex[1942:a0b] library routine called out of sequence
2013-11-26 12:25:38.229 Publilex[1942:a0b] Uncaught exception Failed to open database with message 'library routine called out of sequence'.
2013-11-26 12:25:38.261 Publilex[1942:a0b] Stack trace: (
0 CoreFoundation 0x01ef05e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01bc48b6 objc_exception_throw + 44
2 CoreFoundation 0x01ef03bb +[NSException raise:format:] + 139
3 Publilex 0x00027097 -[DBAccess raiseSqliteException:] + 199
4 Publilex 0x00023c3d -[DBAccess open] + 173
5 Publilex 0x00023ae8 +[DBAccess shared] + 232
6 Publilex 0x00027e5e +[Word synIdForWord:] + 78
7 Publilex 0x0002812d +[Word synIdsFor:] + 429
8 Publilex 0x00037b8b -[Searcher nbArticlesFor:] + 187
9 Publilex 0x0002df2b -[SearchViewController updateSuggestionsFor:] + 731
10 Publilex 0x0002e5ef -[SearchViewController textField:shouldChangeCharactersInRange:replacementString:] + 783
11 UIKit 0x00e0fa56 -[UITextField keyboardInputShouldDelete:] + 252
12 UIKit 0x008ff0f7 -[UIKeyboardImpl callShouldDeleteWithWordCountForRapidDelete:characterCountForRapidDelete:] + 691
13 UIKit 0x00909ed5 -[UIKeyboardImpl deleteFromInputWithExecutionContext:] + 84
14 UIKit 0x00906965 -[UIKeyboardImpl handleDeleteAsRepeat:executionContext:] + 130
15 UIKit 0x0091516f -[UIKeyboardImpl handleKeyWithString:forKeyEvent:executionContext:] + 633
16 UIKit 0x00914cb6 -[UIKeyboardImpl handleKeyEvent:executionContext:] + 1808
17 UIKit 0x0091450f __33-[UIKeyboardImpl handleKeyEvent:]_block_invoke + 51
18 UIKit 0x00e371b8 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 402
19 UIKit 0x00e3785f -[UIKeyboardTaskQueue addTask:] + 144
20 UIKit 0x009144d4 -[UIKeyboardImpl handleKeyEvent:] + 227
21 UIKit 0x0073dfbb -[UIApplication _handleKeyUIEvent:] + 330
22 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
23 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
24 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
25 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
26 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
27 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
28 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
29 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
30 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
31 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
32 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
33 UIKit 0x00884634 -[UIResponder(Internal) _handleKeyUIEvent:] + 59
34 UIKit 0x0073de6a -[UIApplication handleKeyUIEvent:] + 84
35 UIKit 0x0073de0e -[UIApplication handleKeyHIDEvent:] + 458
36 UIKit 0x00725c8c _UIApplicationHandleEventQueue + 2954
37 CoreFoundation 0x01e798af __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
38 CoreFoundation 0x01e7923b __CFRunLoopDoSources0 + 235
39 CoreFoundation 0x01e9630e __CFRunLoopRun + 910
40 CoreFoundation 0x01e95b33 CFRunLoopRunSpecific + 467
41 CoreFoundation 0x01e9594b CFRunLoopRunInMode + 123
42 GraphicsServices 0x02ef49d7 GSEventRunModal + 192
43 GraphicsServices 0x02ef47fe GSEventRun + 104
44 UIKit 0x0072a94b UIApplicationMain + 1225
45 Publilex 0x00002893 main + 115
46 libdyld.dylib 0x0246e725 start + 0
)
+(DBAccess *)shared{
@synchronized(self){
if (sharedInstance == nil){
sharedInstance = [[DBAccess alloc] initWithFileName:DATABASE_NAME];
[sharedInstance createEditableCopyOfDatabaseIfNeeded];
}
[sharedInstance open];
}
return sharedInstance;
}
- (NSArray *) executeSQLNoCache:(NSString *)sql{
NSLog(@"%@ - Execution No Cache", sql);
char* errorMessage;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSMutableDictionary *queryInfo = [[NSMutableDictionary alloc] initWithCapacity:1];
[queryInfo setObject:sql forKey:@"sql"];
NSMutableArray *rows = [[NSMutableArray alloc] init];
sqlite3_stmt *statement = NULL;
int returnCode = sqlite3_prepare_v2(database, [sql UTF8String], -1, &statement, NULL);
if (returnCode == SQLITE_OK) {
BOOL needsToFetchColumnTypesAndNames = YES;
NSArray *columnTypes = nil;
NSArray *columnNames = nil;
while (sqlite3_step(statement) == SQLITE_ROW) {
if (needsToFetchColumnTypesAndNames) {
columnTypes = [self columnTypesForStatement: statement];
columnNames = [self columnNamesForStatement: statement];
needsToFetchColumnTypesAndNames = NO;
}
NSMutableDictionary *row = [[NSMutableDictionary alloc] init];
[self copyValuesFromStatement:statement
toRow:row
queryInfo:queryInfo
columnTypes:columnTypes
columnNames:columnNames];
[rows addObject:row];
[row release];
}
} else {
sqlite3_finalize(statement);
[self raiseSqliteException:
[[NSString stringWithFormat:@"Failed to execute statement : '%@' with message: ", sql] stringByAppendingString:@"%S"]];
}
[queryInfo release];
sqlite3_exec(database, "COMMIT TRANSACTION", NULL, NULL, &errorMessage);
sqlite3_finalize(statement);
[pool release];
return rows;
}
【问题讨论】:
-
由于异常来自
open,所以很高兴看到它的来源。 -
抱歉,刚刚看到您的回复。正如您在日志下方看到的那样,您拥有共享实例代码和执行我的 SQL 请求而没有缓存。该代码使用 iOS 6 可以正常工作,但现在我遇到了意外崩溃,该崩溃可以重现,但无法通过特定操作或使用时间来重现。
-
所以你不会给我们任何关于 DBAccess 发生了什么的线索?
-
我给你所有的线索,让我知道你需要什么信息
-
DBAccess 发生了什么?????????????????????