Search code examples
iosobjective-cobjectivezip

How detect ZipException with Objective-Zip?


I use Objective-Zip from github - https://github.com/flyingdolphinstudio/Objective-Zip If zip file broken i have this:

Terminating app due to uncaught exception 'ZipException', reason: 'Can't open

And app crash after that. How to get the error but the program did not fall?


Solution

  • Simply catch the exception:

    @try {
        // Zip code here
    }
    @catch (ZipException *exception) {
        // Error happened, do whatever you need
    }