let rootInfo = realm.objects(StoreRealM.self).filter(msg)
var root = [StoreRealM]()
for i in 0 ..< rootInfo.count {
if let result = rootInfo[i] as? StoreRealM {
root.append(result)
}
}
在这一行 if let result = rootInfo[i] as? StoreRealM
我明白了。我也得到了
来自&#39; StoreRealM&#39;的有条件演员表到&#39; StoreRealM&#39;总是成功
答案 0 :(得分:3)
由于root只能包含/* ---------- Get row query parameter from AJAX GET ---------- */
$n = $_GET['row'];
/* =============================================
= Section : Table row logic =
============================================= */
// Write here your row logic and pass it to tr.
// E.g:
define('SPARES_ID', 'xxx');
define('SPARES_BRIEFDESC', 'xxx');
define('UNIT_ID', 'xxx');
define('UNIT_DESC', 'xxx');
$query2 = '';
$m = '';
/* ===== End of Section ====== */
/* ---------- Generate Table Row and return it---------- */
echo $tr = '<tr> '
. '<td class="no">' . $n . '</td>'
. '<td>' . creaLista('mrditemid[]', 3, SPARES_ID, SPARES_BRIEFDESC, $query2, $m) . '</td>'
. '<td>' . creaLista('mrdunits[]', 4, UNIT_ID, UNIT_DESC, $query2, $m) . '</td>'
. '<td><input type="text" class="form-control mrdquantity" name="mrdquantity[]"></td>'
. '<td><input type="text" class="form-control mrdremarks" name="mrdremarks[]"></td>'
. '<td><button class="btnDelete btn btn-danger">-</td>'
. '</tr>';
exit();
个对象(由编译器保证),因此您无需将索引访问权限转换为此类型;更重要的是,它不能包含StoreRealM
个对象。
所以编写for循环就足够了:
Optional<StoreRealM>