跳到主要内容

图片管理

更新时间:2026-10-23 11:31:55

根据图片ID列表获取图片地址​

注意

​ 本接口是批量接口,在可批量获取的场景下,请不要单个来请求,会影响平台服务

// 导入设备管理SDK头文件
#import <RTCXDeviceCenter/RTCXDeviceCenter.h>

调用API接口

@protocol RTCXCloudStorageProtocol <NSObject>
/**
* 根据图片ID列表获取图片地址
*
* @param req 请求参数对象
* @param onSuccess 成功回调
* @param onError 失败回调
*/
- (void)queryPictureUrlByIdWithReq:(nonnull RTCXCloudStoragePicUrlReq *)req onSuccess:(nullable RTCXCloudStorageOnSuccess)onSuccess onError:(nullable RTCXCloudStorageOnError)onError;
@end

调用示例如下

__weak typeof(self) weakSelf = self;
RTCXCloudStoragePicUrlReq *req = [[RTCXCloudStoragePicUrlReq alloc] init];
req.iotId = self.device.iotId;
req.pictureIdList = @[@"main/1/1/1740485609452",@"main/1/1/1740485590002",@"main/1/1/1740485528152",@"main/1/1/1740485527952"];
[RTCXDeviceService(RTCXCloudStorageProtocol) queryPictureUrlByIdWithReq:req onSuccess:^(id _Nullable data, id _Nullable rawData) {
RTCXCloudStoragePicUrlListRsp *rsp = data;
weakSelf.dataArray = [NSArray iotyy_modelArrayWithClass:[PictureUrlModel class] json:[rsp.pictureList iotyy_modelToJSONString]];
[weakSelf.tableView.hwhd_rowArray addObjectsFromArray:weakSelf.dataArray];
[weakSelf.tableView reloadData];
} onError:^(NSError * _Nullable error) {
[self showToast:[NSString stringWithFormat:@"%ld : %@",error.code,error.userInfo[NSLocalizedFailureReasonErrorKey]]];
}];