|
|
|
| 60分 |
你有用 FMDB 吧?iOS 上不能用 NSFileTypeForHFSTypeCode,更新一下,新版加了编译器指令来判断:
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
- (NSString*)applicationIDString {
NSString *s = NSFileTypeForHFSTypeCode([self applicationID]);
assert([s length] == 6);
s = [s substringWithRange:NSMakeRange(1, 4)];
return s;
}
- (void)setApplicationIDString:(NSString*)s {
if ([s length] != 4) {
NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]);
}
[self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"""%@""", s])];
}
#endif
|
|
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
如果加了这个,那我之前的#if SQLITE_VERSION_NUMBER >= 3007017这个就会提示错误 如果把#if SQLITE_VERSION_NUMBER >= 3007017删掉,就正常了,但是数据显示不出来了。 |
|
|
不要自己去改 FMDB 源码,更新一下 FMDB 的版本:
#if SQLITE_VERSION_NUMBER >= 3007017
- (uint32_t)applicationID {
uint32_t r = 0;
FMResultSet *rs = [self executeQuery:@"pragma application_id"];
if ([rs next]) {
r = (uint32_t)[rs longLongIntForColumnIndex:0];
}
[rs close];
return r;
}
- (void)setApplicationID:(uint32_t)appID {
NSString *query = [NSString stringWithFormat:@"pragma application_id=%d", appID];
FMResultSet *rs = [self executeQuery:query];
[rs next];
[rs close];
}
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
- (NSString*)applicationIDString {
NSString *s = NSFileTypeForHFSTypeCode([self applicationID]);
assert([s length] == 6);
s = [s substringWithRange:NSMakeRange(1, 4)];
return s;
}
- (void)setApplicationIDString:(NSString*)s {
if ([s length] != 4) {
NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]);
}
[self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"""%@""", s])];
}
#endif
#endif
|
|
|
谢谢,解决了。
|
|
|
你好,我也遇到来同样饿问题,请问,代码加到哪个文件?
|
|
|
重新down一个新的FMDB替换
https://codeload.github.com/ccgus/fmdb/zip/master |
|
