NSURLErrorDomain:-1003 [英] 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屋!