相关疑难解决方法(0)

Swift编译器错误:字符串连接上的"表达式太复杂"

我觉得这比任何事都更有趣.我修好了,但我想知道原因.这是错误:DataManager.swift:51:90: Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions.为什么抱怨?这似乎是最简单的表达方式之一.

编译器指向该columns + ");";部分

func tableName() -> String { return("users"); } 

func createTableStatement(schema: [String]) -> String {

    var schema = schema;

    schema.append("id string");
    schema.append("created integer");
    schema.append("updated integer");
    schema.append("model blob");

    var columns: String = ",".join(schema);

    var statement = "create table if not exists " + self.tableName() + "(" + columns + ");";

    return(statement);
}
Run Code Online (Sandbox Code Playgroud)

修复是:

var statement = "create …
Run Code Online (Sandbox Code Playgroud)

xcode functional-programming compiler-errors ios swift

139
推荐指数
3
解决办法
4万
查看次数