at-internet / piano-analytics-apple

Piano Analytics Apple SDK repository
https://developers.atinternet-solutions.com/piano-analytics/
MIT License
7 stars 13 forks source link

fix: SPM configuration crash with app name containing spaces #1

Closed boorik closed 1 year ago

boorik commented 2 years ago

Using the lib in an application with a name containing spaces crashes at start because it can't find the default.json file. PianoAnalytics: a default config should be provided inside the framework

The reason is that "%20" characters are inserted in the path by the use of url(forResource line 322 this lead to

static func JSONFileToMap(path: String) -> [String: String]? {
        do {
            let data = try Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe)

throw No such file or directory

I have added a new test target containing spaces "Piano Analytics Tests" to reproduce the error. Finally Bundle.module.path fix the issue.

piano-analytics commented 1 year ago

Hello, This is implemented with version 3.0.2 : )