在内容模块中上传图片后如何更新图片? 我在下面的代码上传文件代码
// Upload a file to the Content module
NSData *imageData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image45" ofType:@"png"]];
[QBRequest TUploadFile:imageData fileName:@"arrow.png" contentType:@"image/png" isPublic:NO successBlock:^(QBResponse *response, QBCBlob *uploadedBlob) {
// set dialog's photo
NSUInteger uploadedFileID = uploadedBlob.ID;
dialog.photo = [NSString stringWithFormat:@"%d", uploadedFileID];
} statusBlock:^(QBRequest *request, QBRequestStatus *status) {
// handle progress
} errorBlock:^(QBResponse *response) {
NSLog(@"error: %@", response.error);
}];
答案 0 :(得分:2)
查找更新内容文件的此代码
NSData *file = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"plus" ofType:@"png"]];
QBCBlob *blob = [QBCBlob blob];
blob.ID = 65268; // ID of exists file
blob.name = @"Plus";
[QBRequest TUpdateFileWithData:file file:blob successBlock:^(QBResponse *response) {
// File updated
// if blob.isPublic == YES
NSString *url = [blob publicUrl];
} statusBlock:^(QBRequest *request, QBRequestStatus *status) {
// handle progress
} errorBlock:^(QBResponse *response) {
NSLog(@"error: %@", response.error);
}];