Marino Faggiana 7 năm trước cách đây
mục cha
commit
b1d827e8ba
1 tập tin đã thay đổi với 6 bổ sung5 xóa
  1. 6 5
      iOSClient/Networking/CCNetworking.m

+ 6 - 5
iOSClient/Networking/CCNetworking.m

@@ -499,7 +499,6 @@
         if (result) return;
         
         // File exists ?
-        
         tableLocalFile *localfile = [[NCManageDatabase sharedInstance] getTableLocalFileWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadata.fileID]];
         
         if (localfile != nil && [[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", _directoryUser, metadata.fileID]]) {
@@ -674,10 +673,12 @@
     // If fileID do not exists return.
     if (!fileID) return;
     
-    // Progress Task
-    NSDictionary* userInfo = @{@"fileID": (fileID), @"serverUrl": (serverUrl), @"cryptated": ([NSNumber numberWithBool:NO]), @"progress": ([NSNumber numberWithFloat:0.0])};
-    [[NSNotificationCenter defaultCenter] postNotificationName:@"NotificationProgressTask" object:nil userInfo:userInfo];
-
+    dispatch_async(dispatch_get_main_queue(), ^{
+        // Progress Task
+        NSDictionary* userInfo = @{@"fileID": (fileID), @"serverUrl": (serverUrl), @"cryptated": ([NSNumber numberWithBool:NO]), @"progress": ([NSNumber numberWithFloat:0.0])};
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"NotificationProgressTask" object:nil userInfo:userInfo];
+    });
+        
     if (errorCode != 0) {
         
         if (errorCode != kCFURLErrorCancelled) {