sunshinejr / SwiftyUserDefaults

Modern Swift API for NSUserDefaults
http://radex.io/swift/nsuserdefaults/static
MIT License
4.84k stars 364 forks source link

SwiftyUserDefaults 5.0.0-beta.2 cause error on Xcode 11 SwiftUI Canvas #211

Closed christinachanhk closed 4 years ago

christinachanhk commented 4 years ago

I am using Xcode 11 GM Seed with SwiftyUserDefaults 5.0.0-beta.2, SwiftUI's canvas for previewing layout cause the following error. I also tired to downgrade SwiftyUserDefaults version to 4.0.0 and everything works fine.

linker command failed with exit code 1 (use -v to see invocation)


Failed to build the scheme "Testing": Link /Users/daniel/Library/Developer/Xcode/DerivedData/Testing-epcackvmcahjtubjqjwkhgqsrspu/Build/Intermediates.noindex/Previews/Testing/Products/Debug-iphonesimulator/libCwlCatchException.dylib: Undefined symbols for architecture x86_64: "_catchExceptionOfKind", referenced from: CwlCatchException.(catchReturnTypeConverter in _841BEC3F94220F0DFD4EA4E9DDB3DC93)(_: A.Type, block: () -> ()) -> A? in CwlCatchException.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Link /Users/daniel/Library/Developer/Xcode/DerivedData/Testing-epcackvmcahjtubjqjwkhgqsrspu/Build/Intermediates.noindex/Previews/Testing/Products/Debug-iphonesimulator/libCwlPreconditionTesting.dylib: clang: error: no such file or directory: '/Users/daniel/Library/Developer/Xcode/DerivedData/Testing-epcackvmcahjtubjqjwkhgqsrspu/Build/Intermediates.noindex/Previews/Testing/Products/Debug-iphonesimulator/libCwlCatchException.dylib' Command Ld failed with a nonzero exit code

sunshinejr commented 4 years ago

Hey @christinachanhk! What macOS version do you use? Also, do you use SPM? If so, can you post the version numbers of all fetched dependencies?

christinachanhk commented 4 years ago

I am using macOS Catalina 10.15 beta 8, and I m using SPM. Thanks so much for your help.

image
sunshinejr commented 4 years ago

Aight thanks! One more question, can you post your Package.swift maybe?

christinachanhk commented 4 years ago

Thanks :)

image
sunshinejr commented 4 years ago

Hey @christinachanhk I found the issue - seems to be that the Nimble dependency wasn't released yet with newest beta for Cwl libs. Adding the package git@github.com:Quick/Nimble.git to your project and use branch: master should in theory resolve your problem... In my project, however, this didn't help - still there seems to be an issue that prevents from starting the app. This is really all because of the fact that SPM for some reason builds testing packages that are not even included in the main app.

Because of that I'm gonna remove testing in SPM as this is horrible user experience. You don't need to even fetch all of these testing libraries and yet this is something preventing you from using the library in your app.

I'm gonna comment here once it's implemented, tested and done. Shouldn't be too long, already on it.

christinachanhk commented 4 years ago

I tried to add git@github.com:Quick/Nimble.git with master branch, and the app crashed during launch.

I guess I just simply wait for your update will be fine, I will temporary downgrade SwiftyUserDefaults version to 4.0.0 for now. :)

sunshinejr commented 4 years ago

Hey @christinachanhk - I just released version 5.0.0-beta.3. It doesn't fetch testing libraries anymore and it's working fine for me with the preview. Can you try that one out and let me know if it works for you too? Cheers!

christinachanhk commented 4 years ago

It works for me too, thanks so much for your effort.