/ / FMDB, Swift 3, executeUpdate - Compiler-Build fehlgeschlagen - Kompilierung, swift3, fmdb

FMDB, Swift 3, executeUpdate - Compiler-Build fehlgeschlagen - Kompilierung, swift3, fmdb

Ich benutze FMDB mit Swift 3. Bei Swift 2 lief alles gut, aber nach dem Swift-Upgrade bekomme ich: "Befehl fehlgeschlagen wegen Signal: Getötet: 9"

Nach der Untersuchung der Ursache habe ich festgestellt, dass die Ausführung von "executeUpdate" mit etwa 24 Argumenten im ArgumentsArray dazu führt, dass der Compiler sehr langsam ist und schließlich einen Kompilierungsfehler zurückgibt.

Wenn die Anzahl der Argumente im Array auf 20 reduziert wird, ist der Build des Compilers immer noch langsam, kann aber erfolgreich abgeschlossen werden.

Jede Idee, warum / Hilfe wird willkommen sein ...!

Hier ist mein Code: (Build erfolgreich, aber das Auskommentieren der 4 Zeilen unten wird die Erstellung der Kompilierung fehlgeschlagen. Alle anderen 4 Zeilen haben natürlich das gleiche Ergebnis)

func insertLocalization(_ localization: Localization) -> Bool {
print ("Insert Localization: (localization.localization_object_id!)#(localization.spot_object_id!)#(localization.language_code!)")
sharedInstance.database!.open()
let isInserted = sharedInstance.database!.executeUpdate(
"INSERT INTO localizations (" +
"localization_object_id, " +
"spot_object_id, " +
"language_code, " +
"current_location_enabled, " +
"spot_title, " +
"spot_desc, " +
"local_assistant_phone, " +
"orientation_360_enabled, " +
"direction_n_title, " +
"direction_n_desc, " +
"direction_ne_title, " +
"direction_ne_desc, " +
"direction_e_title, " +
"direction_e_desc," +
"direction_se_title, " +
"direction_se_desc, " +
"direction_s_title, " +
"direction_s_desc, " +
"direction_sw_title, " +
"direction_sw_desc, " +
"direction_w_title, " +
"direction_w_desc, " +
"direction_nw_title, " +
"direction_nw_desc) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
withArgumentsIn: [
// localization.localization_object_id!,
// localization.spot_object_id!,
// localization.language_code!,
// localization.current_location_enabled!,
localization.spot_title!,
localization.spot_desc!,
localization.local_assistant_phone!,
localization.orientation_360_enabled!,
localization.direction_n_title!,
localization.direction_n_desc!,
localization.direction_ne_title!,
localization.direction_ne_desc!,
localization.direction_e_title!,
localization.direction_e_desc!,
localization.direction_se_title!,
localization.direction_se_desc!,
localization.direction_s_title!,
localization.direction_s_desc!,
localization.direction_sw_title!,
localization.direction_sw_desc!,
localization.direction_w_title!,
localization.direction_w_desc!,
localization.direction_nw_title!,
localization.direction_nw_desc!
])
sharedInstance.database!.close()
return isInserted
}

Vielen Dank!

Antworten:

0 für die Antwort № 1

Dieser Code kompiliert für mich in Xcode 8.0 (8A218a) ohne Zwischenfälle. Aber wenn das nicht für dich funktioniert, würde ich zum Beispiel vorschlagen, das Line-Up aufzuteilen

let values =  [localization.localization_object_id!, ..., localization.direction_nw_desc!]

let isInserted = sharedInstance.database!.executeUpdate(
"INSERT INTO localizations (...) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
withArgumentsIn: values)