Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 隐式转换丢失整数精度:';整数';(又称无符号长字符)到';int';_Objective C_Sqlite - Fatal编程技术网

Objective c 隐式转换丢失整数精度:';整数';(又称无符号长字符)到';int';

Objective c 隐式转换丢失整数精度:';整数';(又称无符号长字符)到';int';,objective-c,sqlite,Objective C,Sqlite,所有sqlite3\u bind\u xxx函数的index参数期望其数据类型为int,而不是NSUInteger 最简单的解决方案是将argIndex参数的数据类型从NSUInteger更改为int。或者在调用sqlite3\u bind\u xxx函数时,将argIndex转换为int值 对于给定的变量,最好总是使用正确的数据类型。这是Objective-C,而不是Swift。可能是重复的。 -(void)bindStatement:(sqlite3_stmt *)statement wit

所有
sqlite3\u bind\u xxx
函数的
index
参数期望其数据类型为
int
,而不是
NSUInteger

最简单的解决方案是将
argIndex
参数的数据类型从
NSUInteger
更改为
int
。或者在调用
sqlite3\u bind\u xxx
函数时,将
argIndex
转换为
int


对于给定的变量,最好总是使用正确的数据类型。

这是Objective-C,而不是Swift。可能是重复的。
-(void)bindStatement:(sqlite3_stmt *)statement withArg:(NSObject *)arg atIndex:(NSUInteger)argIndex
{
    if ([arg isEqual:[NSNull null]]) {
        sqlite3_bind_null(statement, argIndex);//Implicit conversion loses integer precision: 'NSUInteger' (aka 'unsigned long') to 'int'
    } else if ([arg isKindOfClass:[NSNumber class]]) {
        NSNumber *numberArg = (NSNumber *)arg;
        const char *numberType = [numberArg objCType];
        if (strcmp(numberType, @encode(int)) == 0) {
            sqlite3_bind_int(statement, argIndex, [numberArg integerValue]);
        } else if (strcmp(numberType, @encode(long long int)) == 0) {
            sqlite3_bind_int64(statement, argIndex, [numberArg longLongValue]);
        } else if (strcmp(numberType, @encode(double)) == 0) {
            sqlite3_bind_double(statement, argIndex, [numberArg doubleValue]);
        } else {
            sqlite3_bind_text(statement, argIndex, [[arg description] UTF8String], -1, SQLITE_TRANSIENT);
        }