小编Wei*_*Xia的帖子

为什么void函数中出现意外的非void返回值?

我创建了一个从API获取URL的函数,并返回URL字符串作为结果.但是,Xcode给了我这个错误信息:

void函数中出现意外的非void返回值

有谁知道为什么会这样?

func getURL(name: String) -> String {

        let headers: HTTPHeaders = [
            "Cookie": cookie
            "Accept": "application/json"
        ]

        let url = "https://api.google.com/" + name

        Alamofire.request(url, headers: headers).responseJSON {response in
            if((response.result.value) != nil) {
                let swiftyJsonVar = JSON(response.result.value!)

                print(swiftyJsonVar)

                let videoUrl = swiftyJsonVar["videoUrl"].stringValue

                print("videoUrl is " + videoUrl)

                return (videoUrl)   // error happens here
            }
        }
}
Run Code Online (Sandbox Code Playgroud)

ios swift alamofire

2
推荐指数
1
解决办法
4424
查看次数

如何在Apple TV中编辑视频信息?

我尝试在Info Box下的视频中添加一些基本信息,但我不知道如何添加或更新它?

谁知道怎么做?

在此输入图像描述

apple-tv tvos tvml tvos9.1

1
推荐指数
1
解决办法
354
查看次数

标签 统计

alamofire ×1

apple-tv ×1

ios ×1

swift ×1

tvml ×1

tvos ×1

tvos9.1 ×1