Skip to content

Commit

Permalink
update for response for oct-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
namo-py committed Aug 30, 2018
1 parent 103cf3e commit 09550e3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion SBFileStreamer.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SBFileStreamer"
s.version = "1.3.0"
s.version = "1.3.1"
s.summary = "Basic file streamer for iOS development."
s.description = "Basic file streamer for Objc.Inc iOS Developers, such as ViewController/View etc."

Expand Down
15 changes: 7 additions & 8 deletions SBFileStreamer/SBFileStreamer/SBFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,13 @@ + (NSString *)whc_SqliteVersion {
}

#pragma mark --- getter
//- (AFHTTPSessionManager *)manager {
// if (!_manager) {
// NSURLSessionConfiguration *cfg = [NSURLSessionConfiguration defaultSessionConfiguration];
// _manager = [AFHTTPSessionManager manager];
// }
// return _manager;
//}
- (AFHTTPSessionManager *)fetchManager {
return [AFHTTPSessionManager manager];
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
AFJSONRequestSerializer *serializer = [AFJSONRequestSerializer serializer];
[serializer setStringEncoding:NSUTF8StringEncoding];
manager.requestSerializer=serializer;
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
return manager;
}
- (NSFileHandle *)fileHandler {
if (!_fileHandler) {
Expand Down Expand Up @@ -183,6 +181,7 @@ - (NSURLSessionDataTask *)fetchTask {
__weak typeof (self) this = self;AFHTTPSessionManager *manager = [self fetchManager];
//completed callback
_task = [manager dataTaskWithRequest:req uploadProgress:nil downloadProgress:nil completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {

NSLog(@"download did completed!---error:%@", error.localizedDescription);
//close file handle
[this.fileHandler closeFile];
Expand Down
8 changes: 6 additions & 2 deletions SBFileStreamer/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ - (void)viewDidLoad {

- (void)testDownload {

NSString *uri = @"http://speedtest.tokyo.linode.com/100MB-tokyo.bin";
NSString *key = @"100MB-tokyo.bin";
// NSString *uri = @"http://speedtest.tokyo.linode.com/100MB-tokyo.bin";
// NSString *key = @"100MB-tokyo.bin";
// NSString *owner = @"nanhujiaju";

NSString *uri = @"http://7xrm04.com2.z0.glb.qiniucdn.com/3bfe46c3621abf2bc89f50969a74c9a2.lrc";
NSString *key = @"3bfe46c3621abf2bc89f50969a74c9a2.lrc";
NSString *owner = @"nanhujiaju";

SBFile *file = [SBFile fileWithUri:uri key:key storage:SBFileCloudQiNiu owner:owner];
Expand Down

0 comments on commit 09550e3

Please sign in to comment.