gpt4 book ai didi

ios - Xcode-sqlite3.dylib : illegal multi-thread access to database connection

转载 作者:行者123 更新时间:2023-11-28 20:57:06 25 4
gpt4 key购买 nike

我很难过..

设置:Xcode 9.4.1 (9F2000)运行于:iOS 模拟器 iPhone 8 (11.4)sqlite3 配置:sqlite3_config(SQLITE_CONFIG_SERIALIZED);

问题

1) “[logging] BUG IN CLIENT OF sqlite3.dylib: illegal multi-threaded access to database connection”在线错误

if(sqlite3_prepare_v2(_contactDB, query_stmt, -1, &statment, NULL) == SQLITE_OK )
==> EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

我能做的就是改变

if(sqlite3_open([[self filepath] UTF8String], &db)!= SQLITE_OK)

if (sqlite3_open_v2([[self filepath] UTF8String], &db, SQLITE_OPEN_READWRITE|SQLITE_OPEN_FULLMUTEX, NULL) != SQLITE_OK)

但这引出了第二个问题

2) 在我执行 Simulator -> Erase All Contents and Settings 后,运行该应用程序会出现错误“libc++abi.dylib:终止并出现 NSException 类型的未捕获异常”

class AppDelegate: UIResponder, UIApplicationDelegate, PKPushRegistryDelegate
==> signal SIGABRT

完整日志

[logging] API call with invalid database connection pointer
[logging] misuse at line 123231 of [2b0954060f]
[logging] API called with NULL prepared statement
[logging] misuse at line 83511 of [2b0954060f]
SQL Error. Not able to add the record. SQL: INSERT INTO SERVER_LIST
(a, b, c, dh) VALUES ("1", "2", "3, "4")
[logging] API call with invalid database connection pointer
[logging] misuse at line 148673 of [2b0954060f]
[logging] API call with invalid database connection pointer
[logging] misuse at line 123231 of [2b0954060f]
*** Terminating appxdue to uncaught exception 'NSRangeException',
reason: '*** -[__NSArrayMobjectAtIndex:]: index 18446744073709551615
beyond bounds for empty array'

*** First throw call stack:
(
0 CoreFoundation 0x000000010ce0d1e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x000000010c4aa031 objc_exception_throw + 48
2 CoreFoundation 0x000000010ce4d0bc _CFThrowFormattedException + 194
3 CoreFoundation 0x000000010cd3ce76 -[__NSArrayM objectAtIndex:] + 150
4 App 0x0000000106a60570 _T06App7loginVCC13newaccountAddyyF + 1296
5 App 0x0000000106a610e4 _T06App7loginVCC13newaccountAddyyFTo + 36
6 CoreFoundation 0x000000010cda8b8c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
7 CoreFoundation 0x000000010cda8a65 _CFXRegistrationPost + 453
8 CoreFoundation 0x000000010cda87a1 ___CFXNotificationPost_block_invoke + 225
9 CoreFoundation 0x000000010cd6a422 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826
10 CoreFoundation 0x000000010cd695a1 _CFXNotificationPost + 609
11 Foundation 0x0000000109ccbe57 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
12 App 0x000000010663fafb __41-[AppServer verification:url:records:]_block_invoke_2 + 2363
13 App 0x00000001065dab94 __91-[AFHTTPSessionManager POST:parameters:constructingBodyWithBlock:progress:success:failure:]_block_invoke.106 + 228
14 App 0x00000001065c3db9 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.119 + 201
15 libdispatch.dylib 0x000000010f2397ab _dispatch_call_block_and_release + 12
16 libdispatch.dylib 0x000000010f23a7ec _dispatch_client_callout + 8
17 libdispatch.dylib 0x000000010f245a3c _dispatch_main_queue_callback_4CF + 993
18 CoreFoundation 0x000000010cdcfc99 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
19 CoreFoundation 0x000000010cd93ea6 __CFRunLoopRun + 2342
20 CoreFoundation 0x000000010cd9330b CFRunLoopRunSpecific + 635
21 GraphicsServices 0x0000000110dbda73 GSEventRunModal + 62
22 UIKit 0x000000010a30f057 UIApplicationMain + 159
23 App 0x0000000106b64567 main + 55
24 libdyld.dylib 0x000000010f2b7955 start + 1
25 ??? 0x0000000000000001 0x0 + 1
)

请帮忙,这个错误让我陷入困境..

谢谢!

最佳答案

通过将打开的代码改成

解决了
if (sqlite3_open_v2([[self filepath] UTF8String], &db_sns, SQLITE_OPEN_READWRITE|SQLITE_OPEN_FULLMUTEX|SQLITE_OPEN_CREATE, NULL) != SQLITE_OK)

关于ios - Xcode-sqlite3.dylib : illegal multi-thread access to database connection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51145708/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com