NSURLErrorDomain:-1003 [英] NSURLErrorDomain: -1003

查看:266
本文介绍了NSURLErrorDomain:-1003的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode中运行应用程序时,我得到了NSURLErrorDomain:-1003。我没有在StackOverflow上看到此错误,对此有任何线索吗?
我正在使用Alamofire 4

  func fetchAllPosts(){
Alamofire.request( http:/ /www.somthing.com/wp-json/wp/v2/posts?categories_exclude=9\").responseJSON
{如果让数据= response.data {
do {
let newPosts =试试JSONDecoder()。decode(Posts.self,from:data)
self.posts = newPosts.items
//成功
self.fetchAllPostsDidSucceed()


print(已加载的帖子数:\(newPosts.items.count))
}




[17655:2080758] [] nw_proxy_resolver_create_parsed_array PAC评估错误:NSURLErrorDomain:-1003



解决方案

-1003是


I am getting an NSURLErrorDomain: -1003 while I am running my application in Xcode. I haven't seen this error on StackOverflow, any clue about this? I am using Alamofire 4

func fetchAllPosts() {
        Alamofire.request("http://www.somthing.com/wp-json/wp/v2/posts?categories_exclude=9").responseJSON
            { response in
                if let data = response.data {
                    do {
                        let newPosts = try JSONDecoder().decode(Posts.self, from: data)
                        self.posts = newPosts.items
                        // Success
                        self.fetchAllPostsDidSucceed()           


                        print("number of posts loaded: \(newPosts.items.count)")
                    }

[17655:2080758] [] nw_proxy_resolver_create_parsed_array PAC evaluation error: NSURLErrorDomain: -1003

解决方案

-1003 is NSURLErrorCannotFindHost.

If you ever need to look up a NSURLError code in the future, press shift+command+o (the letter "oh") in Xcode, search for NSURLError, unselect the "Swift" toggle in the upper right corner of the search box and choose/open NSURLError.h, and you’ll see all the codes that header file.

This particular error can be caused by any of a number of issues. For example, if this is a macOS app, you may want to go to your target settings, click on the "Capabilities" tag and make sure that "Outgoing Connections (Client)" is selected.

这篇关于NSURLErrorDomain:-1003的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆