无法打开网址

问题描述

我有以下代码

Failed to load interface for ‘Data.Random’
Perhaps you meant Data.Ratio (from base-4.9.0.0)
Use -v to see a list of the files searched for.

我得到的错误

let reachUrl = "https://helpers.pythonanywhere.com/load-data/announcements?key=\(key)&data=[\"\(nameTF.text!)\",\"\(infoTF.text!)\",\"\(pickerView.selectedRow(inComponent: 0))\"]"
        
UIApplication.shared.open(URL(string: reachUrl.addingPercentEncoding(withAllowedCharacters: .alphanumerics)!)!)

错误显示在控制台中,应用程序本身没有执行任何操作。

我想知道怎么回事。感谢您的帮助

解决方法

我知道问题出在哪里,请您试试下面的代码,让我知道它是否有效。

let reachUrl = "https://helpers.pythonanywhere.com/load-data/announcements?key=\(key)&data=[\"\(nameTF.text!)\",\"\(infoTF.text!)\",\"\(pickerView.selectedRow(inComponent: 0))\"]"
        
UIApplication.shared.open(URL(string: reachUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!)!)

谢谢, 快乐编码。