I have a weird issue when using the Swift native SDK component URLComponent.
This is the code in question: -
private func applyDynamicHost(url initialUrl: URLString?) -> URLString? {
guard let url = initialUrl else { return nil }
guard var urlComponents = URLComponents.init(string: url) else { return nil }
urlComponents.host = hostName
urlComponents.scheme = NetworkConfig.serverProtocol
guard let finalUrlString = urlComponents.string else { return nil }
return finalUrlString // CI
// return finalUrlString.removingPercentEncoding // local
}
It takes an url and swaps the host name and protocol to some determined by the app.
Now notice the return value for CI, there’s no “removePercentEncoding”, that’s because it doesn’t seem to need it on the Bitrise CI box. However, if i run exactly the same code locally, it doesn’t remove the percent encoding and I have to apply that myself. This is annoying as it means I have to manually change code everytime I want to run tests locally.
I appear to be running the same version of xCode on both my laptop and desktop as that on Bitrise Box.
8.3.x
Anyone else stumbled across this weirdness or something similar?
Note: I haven’t tried on a blank project yet so it could very well be something wrong in my app but with such a simple change I can’t see why that would be?
Daniel.