【问题标题】:How to retrieve Google Search Results in IOS如何在 IOS 中检索 Google 搜索结果
【发布时间】:2016-02-02 00:40:05
【问题描述】:

我根据这篇文章设置了自定义 Google 搜索:What are the alternatives now that the Google web search API has been deprecated?

现在我需要在我的应用程序中实现它,并且我想触发一个搜索我的自定义搜索的请求,我需要处理我得到的结果(我相信是 JSON)。

我想我需要使用NSURLSession 来发出请求,但我不太清楚正确的语法。

这是自定义搜索的 URL:https://cse.google.com/cse/publicurl?cx=XXXXXXXXX:XXXXXXXXXX

【问题讨论】:

    标签: ios swift search google-search


    【解决方案1】:

    修改它以满足您的需要:

    googleUrl = "https://cse.google.com/cse/publicurl?cx=XXXXXXXXX:XXXXXXXXXX"
    guard url = NSURL(string: googleUrl) else { return }
    NSURLSession.sharedSession().dataTaskWithURL(url) {
        (data, response, error) in
        // deal with error etc accordingly       
    }
    

    【讨论】:

    猜你喜欢
    • 2011-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多