@@ -50,6 +50,8 @@ - (IBAction)uploadAction:(UIButton *)sender {
5050
5151#ifdef YourToken
5252 NSString *path = [[NSBundle mainBundle ] pathForResource: @" UploadResource.dmg" ofType: nil ];
53+ path = [[NSBundle mainBundle ] pathForResource: @" image.png" ofType: nil ];
54+ path = [[NSBundle mainBundle ] pathForResource: @" image.jpg" ofType: nil ];
5355 path = [[NSBundle mainBundle ] pathForResource: @" UploadResource_6M.zip" ofType: nil ];
5456// path = [[NSBundle mainBundle] pathForResource:@"UploadResource_1.44G.zip" ofType:nil];
5557
@@ -90,12 +92,13 @@ - (void)changeUploadState:(UploadState)uploadState{
9092
9193- (void )uploadImageToQNFilePath : (NSString *)filePath {
9294
93- kQNGlobalConfiguration .isDnsOpen = false ;
95+ // kQNGlobalConfiguration.isDnsOpen = false;
96+
9497
9598 NSString *key = [NSString stringWithFormat: @" iOS_Demo_%@ " , [NSDate date ]];
9699 self.token = YourToken;
97100 QNConfiguration *configuration = [QNConfiguration build: ^(QNConfigurationBuilder *builder) {
98- builder.useConcurrentResumeUpload = NO ;
101+ builder.useConcurrentResumeUpload = true ;
99102 builder.resumeUploadVersion = QNResumeUploadVersionV2;
100103 builder.recorder = [QNFileRecorder fileRecorderWithFolder: [NSHomeDirectory () stringByAppendingPathComponent: @" Documents" ] error: nil ];
101104 }];
@@ -121,27 +124,27 @@ - (void)uploadImageToQNFilePath:(NSString *)filePath {
121124// }
122125// option:uploadOption];
123126
124- // long long fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil] fileSize];
125- // NSInputStream *stream = [NSInputStream inputStreamWithFileAtPath:filePath];
126- // [upManager putInputStream:stream sourceId:filePath.lastPathComponent size:fileSize fileName:filePath.lastPathComponent key:key token:self.token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
127- // NSLog(@"info ===== %@", info);
128- // NSLog(@"resp ===== %@", resp);
129- //
130- // [weakSelf changeUploadState:UploadStatePrepare];
131- // [weakSelf alertMessage:info.message];
132- // } option:uploadOption];
133-
134- // NSURL *url = [NSURL fileURLWithPath:filePath];
135- // PHFetchResult *fetchResult = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
136- PHAsset *asset = [self getPHAssert ];
137- [upManager putPHAsset: asset key: key token: self .token complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
127+ long long fileSize = [[[NSFileManager defaultManager ] attributesOfItemAtPath: filePath error: nil ] fileSize ];
128+ NSInputStream *stream = [NSInputStream inputStreamWithFileAtPath: filePath];
129+ [upManager putInputStream: stream sourceId: filePath.lastPathComponent size: fileSize fileName: filePath.lastPathComponent key: key token: self .token complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
138130 NSLog (@" info ===== %@ " , info);
139131 NSLog (@" resp ===== %@ " , resp);
140132
141133 [weakSelf changeUploadState: UploadStatePrepare];
142134 [weakSelf alertMessage: info.message];
143- }
144- option: uploadOption];
135+ } option: uploadOption];
136+
137+ // NSURL *url = [NSURL fileURLWithPath:filePath];
138+ // PHFetchResult *fetchResult = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
139+ // PHAsset *asset = [self getPHAssert];
140+ // [upManager putPHAsset:asset key:key token:self.token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
141+ // NSLog(@"info ===== %@", info);
142+ // NSLog(@"resp ===== %@", resp);
143+ //
144+ // [weakSelf changeUploadState:UploadStatePrepare];
145+ // [weakSelf alertMessage:info.message];
146+ // }
147+ // option:uploadOption];
145148}
146149
147150- (PHAsset *)getPHAssert {
0 commit comments