当我在 Xcode 中运行我的应用程序时,我收到 NSURLErrorDomain: -1003 。我还没有在 StackOverflow 上看到这个错误,有任何线索吗?
我正在使用阿拉莫菲尔 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评估错误:NSURLErrorDomain:-1003
-1003 是NSURLErrorCannotFindHost https://developer.apple.com/documentation/foundation/1508628-url_loading_system_error_codes/nsurlerrorcannotfindhost?language=objc.
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.
此特定错误可能是由许多问题中的任何一个引起的。例如,如果这是 macOS 应用程序,您可能需要转到目标设置,单击“功能”标签并确保选择“传出连接(客户端)”。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)