相关疑难解决方法(0)

在 SQLite.swift 的过滤器中使用变量

SQLite.swift (Branch Swift-1-2)我在 XCode 6.3 beta 的应用程序中使用。我能够创建数据库/表并将条目插入表中。

到目前为止,一切都很好。

现在,当我有一个简单的场景如下:

class Foo {
   var id: Int?
   var name: String?
   /* constructor to create an instance ... */
}

// This is how the table column is defined
var id = Expression<Int64>("id")

// Function to update data in the table
func updateFoo(foo: Foo) -> Int? {
    // 'foos' is the table name
    let candidateFoo = foos.filter(super.id == foo.id!) //<----ERROR!!!
    let (rowsUpdated, statement) = candidateFoo.update(name <- foo.name!)

    if  let rowsUpdated = rowsUpdated …
Run Code Online (Sandbox Code Playgroud)

xcode swift sqlite.swift

5
推荐指数
1
解决办法
2350
查看次数

无法转换“ Int64”类型的值?到预期的参数类型“ Int”

当我尝试将job?.id(一个Int64)作为Int参数传递时(虽然我知道它不是那么大),但迅速的编译器提示此错误,我尝试了几种方法进行转换,但未成功:

Cannot convert value of type 'Int64?' to expected argument type 'Int'
Run Code Online (Sandbox Code Playgroud)

我的代码:

Job.updateJobStatus(token: tok, jobId: job?.id, status:JobSatus.canceled) { (result, error) in
        if result != nil
        {

        }
        else if error != nil
        {

        }
    }
Run Code Online (Sandbox Code Playgroud)

int casting int64 swift

5
推荐指数
2
解决办法
4618
查看次数

标签 统计

swift ×2

casting ×1

int ×1

int64 ×1

sqlite.swift ×1

xcode ×1