Post

Replies

Boosts

Views

Activity

Reply to URLSession.shared.data(from: url) fails in Swift Playgrounds for Mac
I started from: https://www.hackingwithswift.com/forums/swiftui/urlsession-shared-data-from-url-fails-in-swift-playgrounds-for-mac/14987 in the playground, it is clear to me where needsIndefiniteExecution = true goes, simply at the top of the script. In the app I am making, I don’t know where it goes. When I put it at the top of the file, it complains about not being able to run in a global scope. Is there a difference between the playground and the app (made in Swift playgrounds)?
Jun ’22
Reply to URLSession.shared.data(from: url) fails in Swift Playgrounds for Mac
I misread your previous post. Here is a reproducible example, start with File > New App and then a simple app using a network call: import SwiftUI struct Response: Codable {   var results: [Result] } struct Result: Codable {   var trackId: Int   var trackName: String   var collectionName: String } struct ContentView: View {   @State private var results = [Result]()       var body: some View {     List(results, id: \.trackId) { item in       VStack(alignment: .leading) {         Text(item.trackName)           .font(.headline)         Text(item.collectionName)       }     }     .task {       results = await loadData()     }   } } func loadData() async -> [Result]{   var results = [Result(trackId: -1, trackName: "No Tracks Available", collectionName: "No Collection Available")]       let url = URL(string: "https://itunes.apple.com/search?term=taylor+swift&entity=song")       do {     let (data, _) = try await URLSession.shared.data(from: url!)           if let decodedResponse = try? JSONDecoder().decode(Response.self, from: data) {       results = decodedResponse.results     }   } catch {     print("Invalid data")   }   return results } For which I saw: Seems like I might have a wrong setting or something? I have tried this on two separate macbooks with no success on either.
Jun ’22
Reply to Sending MSMessage in iOS 17 Simulator Fails
I have noticed the same thing on my physical device, when trying to send an MSMessage on iOS 17.2, the message does not appear and no errors appear. Clicking on a MSMessage in iOS17.2 (where the MSMessage was previously sent from iOS 16) also fails to load with no error. Not only does it not work in the simulator, but also my production app currently on the App Store. I am also unable to debug the Messages Extension App in XCode, building works fine but when it goes to run on my physical device, XCode itself will crash every time.
Nov ’23