jun7572 5 年之前
父節點
當前提交
70066f9d5d
共有 2 個文件被更改,包括 15 次插入5 次删除
  1. 6 1
      android/src/main/java/com/june/flutterzip/FlutterzipPlugin.java
  2. 9 4
      ios/Classes/FlutterzipPlugin.m

+ 6 - 1
android/src/main/java/com/june/flutterzip/FlutterzipPlugin.java

@@ -50,7 +50,12 @@ public class FlutterzipPlugin implements FlutterPlugin, MethodCallHandler {
       String unzipPath= map.get("unzipPath");
       String outPath=map.get("outPath");
       //
-      ArchiveManager.unzip(unzipPath,outPath ,channel,result);
+      try{
+        ArchiveManager.unzip(unzipPath,outPath ,channel,result);
+      }catch (Exception e){
+        Log.e("Exception",e.toString());
+      }
+
 
 
     } else {

+ 9 - 4
ios/Classes/FlutterzipPlugin.m

@@ -22,10 +22,15 @@
   } else if ([@"unpack" isEqualToString:call.method]){
      NSString *outPath = call.arguments[@"outPath"];
       NSString *unzipPath = call.arguments[@"unzipPath"];
-       BOOL success = [SSZipArchive unzipFileAtPath:unzipPath toDestination:outPath];
-      if(success){
-           result(@"ok");
-      }
+      @try{
+          BOOL success = [SSZipArchive unzipFileAtPath:unzipPath toDestination:outPath];
+               if(success){
+                    result(@"ok");
+               }
+          @catch(NSException *exception) {
+              printf(@"SSZipArchive==NSException")
+          }
+      
   }
 }