您的位置:首页 > 移动开发 > IOS开发

iOS 七牛多张图片上传

2016-01-13 16:22 316 查看
-(void)uploadImages:(NSArray *)images atIndex:(NSInteger)index token:(NSString *)token uploadManager:(QNUploadManager *)uploadManager keys:(NSMutableArray *)keys{
UIImage *image = images[index];
__block NSInteger imageIndex = index;
NSData *data = UIImageJPEGRepresentation(image, 0.5);
NSTimeInterval time= [[NSDate new] timeIntervalSince1970];
NSString *filename = [NSString stringWithFormat:@"%@_%ld_%.f.%@",@"status",686734963504054272,time,@"jpg"];
[uploadManager putData:data key:filename token:token
complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
if (info.isOK) {
[keys addObject:key];
NSLog(@"idInex %ld,OK",index);
imageIndex++;
if (imageIndex >= images.count) {
NSLog(@"上传完成");
for (NSString *imgKey in keys) {
NSLog(@"%@",imgKey);
}
return ;
}
[self uploadImages:images atIndex:imageIndex token:token uploadManager:uploadManager keys:keys];
}

} option:nil];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: