簡體   English   中英

解析服務器不支持的URL

[英]Parse Server Unsupported URL

我目前在Heroku上使用Parse服務器,我在這里使用此鏈接進行部署:

https://github.com/ParsePlatform/parse-server-example#with-the-heroku-button

您只需單擊按鈕,創建application ID, client key, and server URL ,用於從iOS代碼連接到Parse服務器。

現在在我的應用程序中,每當我啟動它時,我都會收到此錯誤:

[Error]: Network connection failed. Making attempt 2 after sleeping for 2.252750 seconds.
[Error]: unsupported URL (Code: 100, Version: 1.12.0)

即使我在下面的代碼中嘗試獲取PFFile中的數據請求,我也會得到與上面相同的錯誤:

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! FollowersTableViewCell

        cell.userNameLabel.text = followUsernameArray[indexPath.row]
        let file = avaArray[indexPath.row]
        file.getDataInBackgroundWithBlock { (data: NSData?, error: NSError?) in
            if error == nil {
                if let data = data {
                    //ERROR HERE. UNSUPPORTED URL!!??
                    let image = UIImage(data: data)
                    cell.avaImageView.image = image
                }
            }else if error != nil {
                print("FROM FOLLOWERS TABLE VC cellForRowAtIndexPath: \(error?.localizedDescription)")
            }
        }

        return cell
    }

我已經去了Plist.info並將App Transport Security SettingsAllow Arbitrary LoadsYES 這也沒有解決問題。 有人對此有任何意見嗎? 非常感謝!

我的問題是服務器中的圖像名稱有一個空格“long name.png”,我猜這是他們的無效字符,將其更改為longName.png並且沒有任何錯誤。 我使用back4app作為我的Parse Server。

看起來Parse iOS SDK在連接到Parse Server時遇到問題。

您可以從兩側檢查並確定其出現故障的位置。

解析SDK:

檢查您的連接URL

Parse.initializeWithConfiguration(ParseClientConfiguration {
    config in
    config.applicationId = <...>
    config.clientKey = <...>
    config.server = <...> // Check this URL
})

對於Heroku,URL看起來應該是這樣的:

https://<your-heroku-app-name>.herokuapp.com/parse

解析服務器:

轉到您的Heroku儀表板並打開“日志”頁面以查看是否:

  • 您的Parse Server啟動並運行時沒有錯誤,您可能希望在查看Log輸出時重新啟動服務器以查看初始化消息。
  • 當SDK嘗試連接到Parse Server時會發生什么。

要在Heroku儀表板的日志中獲取更多信息,請轉到設置>配置變量,並將值環境變量VERBOSE設置為1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM