Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新版1.2引入后会导致FMDB报错 #6

Open
coolwxb opened this issue May 31, 2016 · 4 comments
Open

新版1.2引入后会导致FMDB报错 #6

coolwxb opened this issue May 31, 2016 · 4 comments

Comments

@coolwxb
Copy link

coolwxb commented May 31, 2016

更新到1.2之后引起fmdb初始化错误,如果将库移除了fmdb初始化就正常了

错误日志:
2016-05-31 16:12:30.878 dituwuyou[661:200721] -DBModel init: /var/mobile/Containers/Data/Application/B95688FA-57B3-44DC-8148-750E39FDB8FC/Documents/dituwuyou.sqlite
2016-05-31 16:12:30.895 dituwuyou[661:200721] _path
2016-05-31 16:12:30.895 dituwuyou[661:200721] _queue
2016-05-31 16:12:30.895 dituwuyou[661:200721] _db
2016-05-31 16:12:30.895 dituwuyou[661:200721] -[FMDatabaseQueue db]: unrecognized selector sent to instance 0x12df5bcc0
2016-05-31 16:12:30.896 dituwuyou[661:200721] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FMDatabaseQueue db]: unrecognized selector sent to instance 0x12df5bcc0'
*** First throw call stack:
(0x18201adb0 0x18167ff80 0x182021c4c 0x18201ebec 0x181f1cc5c 0x1005c6a58 0x1828fe3cc 0x181fe455c 0x181fe2464 0x1828fe320 0x1828fe1f0 0x1004850d8 0x1004852e0 0x100484ddc 0x100371240 0x10036e7f4 0x10038e864 0x1871ee9c0 0x18741e184 0x1874225f0 0x18741f764 0x1839bb7ac 0x1839bb618 0x1839bb9c8 0x181fd109c 0x181fd0b30 0x181fce830 0x181ef8c50 0x1871e794c 0x1871e2088 0x1004014b8 0x181a968b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

@CoderJackyHuang
Copy link
Owner

原则上与本库没有关系的。只是格式化一下打印而已啊!调用db做了些什么?代码放出来看看!

原始邮件
发件人:coolwxbnotifications@github.com
收件人:CoderJackyHuang/HYBUnicodeReadableHYBUnicodeReadable@noreply.github.com
发送时间:2016年5月31日(周二) 16:14
主题:[CoderJackyHuang/HYBUnicodeReadable] 新版1.2引入后会导致FMDB报错 (#6)

更新到1.2之后引起fmdb初始化错误,如果将库移除了fmdb初始化就正常了
错误日志:
2016-05-31 16:12:30.878 dituwuyou[661:200721] -DBModel init: /var/mobile/Containers/Data/Application/B95688FA-57B3-44DC-8148-750E39FDB8FC/Documents/dituwuyou.sqlite
2016-05-31 16:12:30.895 dituwuyou[661:200721] _path
2016-05-31 16:12:30.895 dituwuyou[661:200721] _queue
2016-05-31 16:12:30.895 dituwuyou[661:200721] _db
2016-05-31 16:12:30.895 dituwuyou[661:200721] -[FMDatabaseQueue db]: unrecognized selector sent to instance 0x12df5bcc0
2016-05-31 16:12:30.896 dituwuyou[661:200721] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FMDatabaseQueue db]: unrecognized selector sent to instance 0x12df5bcc0'
*** First throw call stack:
(0x18201adb0 0x18167ff80 0x182021c4c 0x18201ebec 0x181f1cc5c 0x1005c6a58 0x1828fe3cc 0x181fe455c 0x181fe2464 0x1828fe320 0x1828fe1f0 0x1004850d8 0x1004852e0 0x100484ddc 0x100371240 0x10036e7f4 0x10038e864 0x1871ee9c0 0x18741e184 0x1874225f0 0x18741f764 0x1839bb7ac 0x1839bb618 0x1839bb9c8 0x181fd109c 0x181fd0b30 0x181fce830 0x181ef8c50 0x1871e794c 0x1871e2088 0x1004014b8 0x181a968b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@coolwxb
Copy link
Author

coolwxb commented May 31, 2016

NSString* docsdir = [NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *dbpath = [docsdir stringByAppendingPathComponent:@"dituwuyou.sqlite"];
FMDatabaseQueue* queue   =[FMDatabaseQueue databaseQueueWithPath:dbpath];
 [queue inTransaction:^(FMDatabase *db, BOOL *rollback){
.....
}

@coolwxb
Copy link
Author

coolwxb commented May 31, 2016

到FMDB内部初始化就报错了

- (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags vfs:(NSString *)vfsName {

    self = [super init];

    if (self != nil) {

        _db = [[[self class] databaseClass] databaseWithPath:aPath];
        FMDBRetain(_db);

#if SQLITE_VERSION_NUMBER >= 3005000
        BOOL success = [_db openWithFlags:openFlags vfs:vfsName];
#else
        BOOL success = [_db open];
#endif
        if (!success) {
            NSLog(@"Could not create database queue for path %@", aPath);
            FMDBRelease(self);
            return 0x00;
        }

        _path = FMDBReturnRetained(aPath);

/*************这句崩溃了***************/
        _queue = dispatch_queue_create([[NSString stringWithFormat:@"fmdb.%@", self] UTF8String], NULL);
/******************************/
        dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL);
        _openFlags = openFlags;
    }

    return self;
}

@yuzhang2
Copy link

和self的description有关,如 NSLog(@"%@", self); 就会出错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants