V
V
Vladislav Resley2020-05-23 22:56:28
iOS
Vladislav Resley, 2020-05-23 22:56:28

When passing a valid url string to the initializer URL(string: urlString) returns nil. How to fix?

When passing a valid url string to the initializer URL(string: urlString) returns nil. How to fix? When entering a value from one word (For example Moscow) everything works, when entering a city from two words, I split the query with split(separator: " ") and join with .joined(separator: "%20") and get the city separated by % 20 and that's it, immediately Nile. How can this problem be solved?

RH1Ju.jpg

KXQfV.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mstrepetov, 2020-05-28
@mstrepetov

I'm trying to register on this resource, but somehow the verification letter does not come. But nevertheless, at the expense of the glorious city of New York, I have doubts that in the address bar it should be transmitted in this way. It's just that when I look at the weather on this resource, the end of the link in the address is new-york-new-york-united-states-of-america-2618724. That is, there are no separators (spaces and various other crap) only en dashes. Can this be the case? Does your api link spits out json to the browser?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question