-canOpenURL: failed for URL: “spotify:” - error: “

2020-05-09 09:05发布

问题:

Not sure if this is true , but from what I've read, people say this issue only occurs on the Xcode simulator so you you must test on an actual device. The problem with this is my current server is a local node server at http://localhost:3000, and my iOS device can not access this server.

1) Is there a way to give my iOS device access to the local server on my device?

2) Why am I getting this error when running the simulator?

I have put the following in my info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>spotify</string>
</array>

回答1:

1) To test on the device - replace the localhost address with your local network IP address. The local network address usually looks like 192.168.xxx.xxx and can be found in network settings.

2) The error simply means that the Spotify app isn't installed. Give your computer a static IP address or you must test on an actual device.