类型 函数 返回值 无 修订版 2024.3703 版本 关键字 iCloud、同步、存储、CloudKit、recordFetchMultiple 参见 iCloud.recordFetch() iCloud.recordQuery() iCloudRecordEvent iCloud.*
检索多个记录。onRecord
监听器函数,最终结果将作为 iCloudRecordEvent 传递给 onComplete
监听器函数。
iCloud.recordFetchMultiple( params )
表。 包含
对于 params
表而言,有效键包括
如果不使用分区,则只需将此值传递为记录标识符 (字符串) 列表
recordNameArray = { "r1", "r2", "r3" }
如果正在使用分区,则将此值传递为包含记录标识符和分区详细信息的 表 数组
recordNameArray = { { recordName="r1", zoneName="z1", zoneOwner="o1" }, { recordName="r2", zoneName="z2", zoneOwner="o2" } }
onComplete
— 必需的 侦听器 函数,该函数将调用 iCloudRecordEvent 来处理整体获取请求。
onRecord
— 可选 监听器 函数,该函数将调用 iCloudRecordEvent 来处理获取请求中的每个记录。
database
— 可选 字符串 值,指示数据库。
containerId
— 可选 字符串 值,指示包含记录的特定 iCloud 容器。如果您仅有一个与其应用程序关联的 iCloud 容器,则不要传递此参数。
-- Listener function to handle per-record events local function recordFetched( event ) print( event.record ) -- Specific fetched record print( event.isError ) -- Indicates whether an error occurred print( event.recordName ) -- If an error occurred, identifies the record involved print( event.error ) -- Description of the error which occurred, if any end -- Listener function to handle the overall fetch request local function fetchResults( event ) print( event.recordArray ) -- Array of successfully retrieved records print( event.isError ) -- Indicates whether an error occurred print( event.error ) -- Description of the error which occurred, if any end iCloud.recordFetchMultiple( { recordNameArray = { "r1", "r2", "r3" }, onRecord = recordFetched, onComplete = fetchResults } )