跳到主要内容

消息网关

更新时间:2025-02-26 13:18:41

根据图片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]]];
}];