pixelglow/ZipZap

iOS app crashes with NSInvalidArgumentException when calling updateEntries

Closed this issue · 2 comments

Hi,

I'm trying to use my files compressing helper that works on Xcode 6 with swift 2.2, on my new app version in Xcode 7 and Swift 3.0.

When calling updateEntries, my app crashes with NSInvalidArgumentException.

Are you aware of such issue?
Do you need me to provide you sample code?

Thanks,
Bertrand

Yes, minimal sample code would be good.

Alright,

so while creating the sample code I've noticed that now ZZArchiveEntry constructor is interpreted form Swift 3 as providing optional ZZArchiveEntry.
This means that the entries array I'm giving updateEntries() function is not anymore an array of ZZArchiveEntry but an array of Optional.

ZZArchive.updateEntries() function is not expecting this so the runtime crashes.
By unwrapping the created ZZArchiveEntry before adding them in the Array solved my issue.

May be this ticket will help others that could have the same issue.