@@ -139,8 +139,8 @@ final class AnisetteDataHelper: WebSocketDelegate
139139 self . printOut ( " Getting provisioning URLs " )
140140 var request = self . buildAppleRequest ( url: URL ( string: " https://gsa.apple.com/grandslam/GsService2/lookup " ) !)
141141 request. httpMethod = " GET "
142- let ( data, response) = try await URLSession . shared. asyncRequest ( request : request)
143- if let data = data ,
142+ let ( data, response) = try await URLSession . shared. data ( for : request)
143+ if
144144 let plist = try ? PropertyListSerialization . propertyList ( from: data, format: nil ) as? Dictionary < String , Dictionary < String , Any > > ,
145145 let startProvisioningString = plist [ " urls " ] ? [ " midStartProvisioning " ] as? String ,
146146 let startProvisioningURL = URL ( string: startProvisioningString) ,
@@ -153,7 +153,7 @@ final class AnisetteDataHelper: WebSocketDelegate
153153 self . printOut ( " Starting a provisioning session " )
154154 return try await self . startProvisioningSession ( )
155155 } else {
156- self . printOut ( " Apple didn't give valid URLs! Got response: \( String ( data: data ?? Data ( " nothing " . utf8 ) , encoding: . utf8) ?? " not utf8 " ) " )
156+ self . printOut ( " Apple didn't give valid URLs! Got response: \( String ( data: data, encoding: . utf8) ?? " not utf8 " ) " )
157157 throw " Apple didn't give valid URLs. Please try again later "
158158 }
159159
@@ -319,13 +319,10 @@ final class AnisetteDataHelper: WebSocketDelegate
319319 self . printOut ( " Trying to get client_info " )
320320 let clientInfoURL = self . url!. appendingPathComponent ( " v3 " ) . appendingPathComponent ( " client_info " )
321321
322- let ( data, response) = try await URLSession . shared. asyncRequest ( url : clientInfoURL)
322+ let ( data, response) = try await URLSession . shared. data ( from : clientInfoURL)
323323
324324
325325 do {
326- guard let data = data else {
327- throw " Couldn't fetch client info. The server may be down "
328- }
329326
330327 if let json = try JSONSerialization . jsonObject ( with: data, options: [ ] ) as? [ String : String ] {
331328 if let clientInfo = json [ " client_info " ] {
@@ -374,9 +371,7 @@ final class AnisetteDataHelper: WebSocketDelegate
374371 " adi_pb " : adiPb
375372 ] , options: [ ] )
376373 request. setValue ( " application/json " , forHTTPHeaderField: " Content-Type " )
377- let ( data, response) = try await URLSession . shared. asyncRequest ( request: request)
378-
379- guard let data else { throw " Couldn't fetch anisette " }
374+ let ( data, response) = try await URLSession . shared. data ( for: request)
380375
381376 return try await self . extractAnisetteData ( data, response as? HTTPURLResponse , v3: true )
382377
0 commit comments