Quickblox在自定义对象中上传文件

时间:2014-08-26 12:18:06

标签: ios objective-c file-upload quickblox

我试图在自定义对象中上传文件,但它不会上传文件。该文件甚至没有上传,而且"附件"数据库上的字段保持为空。 如果我尝试在没有QBCOFile的情况下发送数据,它会上传但是附件"字段保持为空。

我的代码:

    QBCOCustomObject *object = [QBCOCustomObject customObject];
    object.className = @"Custom";
    [object.fields setObject:@"blue" forKey:@"color"];
    QBCOFile *file = [QBCOFile file];
    file.name = @"Picture";
    file.contentType = @"image/png";
    file.data = UIImagePNGRepresentation(stone.picture);
    [object.fields setObject:file forKey:@"attachment"];

    NSMutableArray *customObjects = [NSMutableArray new];
    [customObjects addObject:object];
    [QBCustomObjects createObjects:customObjects className:@"Custom" delegate:self];

1 个答案:

答案 0 :(得分:1)

这是一种错误的方式,

查看本指南http://quickblox.com/developers/SimpleSample-customObjects-ios#Files

你需要下一个:

  1. 使用文件字段
  2. 创建班级的对象
  3. 将文件上传到此字段
相关问题