URL.relative(to:) strange error: CFURLCopyResourcePropertyForKey failed because it was passed a URL which has no scheme

Hi,
I am using URL.relative(to:) with two URLs, which both have 'file' scheme. Nevertheless I still get the error (console output) 'CFURLCopyResourcePropertyForKey failed because it was passed a URL which has no scheme'. This happens when using iOS simulator or on a real device.

Interestingly enough, I still get a result from URL.relative(to:), which seems to be correct as far as I can tell.

Anybody knows what is going on here?

information:
Xcode 14.2 running on macOS Ventura 13.2.1
Simulator running iOS 16.2
IPad running iOS 16.3.1

If you make a minimal reproducible example one of the two things will then happen:

  • by the end of doing so you'll solve the issue yourself.
  • having that minimal example it is more likely that someone on this forum will be able to help you.
1 Like

Sorry for any sort of confusion. For some reason I did not realise that URL.relative(to:) was my own implementation and not part of Foundation. And it is clear to me why the error occurred there. As I do not have permission to remove the topic, maybe some administrator can do that. Thanks!

Heh, as promised, "• by the end of doing so you'll solve the issue yourself."

2 Likes