代码拉取完成,页面将自动刷新
//
// FileViewController.m
// JavaBaas_iOS_SDK
//
// Created by zhaopeng on 16/1/27.
// Copyright © 2016年 Buge. All rights reserved.
//
#import "FileViewController.h"
#import "JavaBaas.h"
@implementation FileViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)createFile:(UIButton *)sender {
}
- (IBAction)upload:(UIButton *)sender {
/**
* 上传文件首先要创建JBFile 提供了3中方法
* fileWithData:
* fileWithName:data:
* fileWithURL:
*/
// 创建对象
UIImage *image = [UIImage imageNamed:@"Test"];
NSData *imageData = UIImagePNGRepresentation(image);
JBFile *file_1 = [JBFile fileWithData:imageData];
// JBFile *file_2 = [JBFile fileWithName:@"test" data:imageData];
// NSString *path = [[NSBundle mainBundle] pathForResource:@"Test@2x.png" ofType:nil];
// NSURL *url = [NSURL fileURLWithPath:path];
// JBFile *file_3 = [JBFile fileWithURL:url];
// 上传
[file_1 saveInBackgroundWithBlock:^(id object, NSError *error) {
if (!error) {
NSLog(@"%@", file_1.url);
} else {
NSLog(@"%@", error);
}
} progressBlock:^(float percentDone) {
NSLog(@"%f", percentDone);
}];
}
@end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。