-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Previous ID | SR-14677 |
Radar | rdar://problem/78698174 |
Original Reporter | MacGregor (JIRA User) |
Type | Bug |
Environment
Raspberry PI 4, 4gb ram, Debian/TwisterOS, swift5.1
Additional Detail from JIRA
Votes | 0 |
Component/s | Foundation |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: f2166f3f1cc9ddf3c5fe1e91bb8d9745
Issue Description:
I am using the following code to get the content from a website. On macOS this works fine, but on the Pi 4 this only throws <Error Domain=NSURLErrorDomain Code=-1 "(null)">. ** I also tried several other ways to download the website content, but they are all throwing the same error on the pi while working fine on the Mac.
Anny ideas how to fit that issue ?
import Foundation **
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
#if os(Linux)
import Glibc
#else
import Darwin.C
#endif
let url = "https://www.google.com"
if let url = URL(string: url) {
**do** {
**let** contents = **try** String(contentsOf: url)
print(contents)
} **catch** { print(error) }
else { print("error") }