Skip to content

Commit f3932a0

Browse files
committed
Remove warnings about implicitly casting types to String when logging
1 parent 2e88a16 commit f3932a0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Source/NativePusher.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@
130130
self.delegate?.debugLog?(message: "No \"id\" key in JSON response: \(json)")
131131
}
132132
} else {
133-
self.delegate?.debugLog?(message: "Could not parse body as JSON object: \(data)")
133+
self.delegate?.debugLog?(message: "Could not parse body as JSON object: \(String(describing: data))")
134134
}
135135
} else {
136136
if data != nil && response != nil {
137137
let responseBody = String(data: data!, encoding: .utf8)
138138
self.delegate?.failedToRegisterForPushNotifications?(response: response!, responseBody: responseBody)
139-
self.delegate?.debugLog?(message: "Bad HTTP response: \(response!) with body: \(responseBody)")
139+
self.delegate?.debugLog?(message: "Bad HTTP response: \(response!) with body: \(String(describing: responseBody))")
140140
}
141141
}
142142
})
@@ -195,7 +195,7 @@
195195
*/
196196
private func modifySubscription(interest: String, change: SubscriptionChange, successCallback: @escaping (Any?) -> Void) {
197197
guard pusherAppKey != nil && clientId != nil else {
198-
self.delegate?.debugLog?(message: "pusherAppKey \(pusherAppKey) or clientId \(clientId) not set - waiting for both to be set")
198+
self.delegate?.debugLog?(message: "pusherAppKey \(String(describing: pusherAppKey)) or clientId \(String(describing: clientId)) not set - waiting for both to be set")
199199
self.requestQueue.pauseAndResetCurrentTask()
200200
return
201201
}
@@ -222,10 +222,10 @@
222222
self.failedRequestAttempts += 1
223223

224224
if error != nil {
225-
self.delegate?.debugLog?(message: "Error when trying to modify subscription to interest: \(error?.localizedDescription)")
225+
self.delegate?.debugLog?(message: "Error when trying to modify subscription to interest: \(String(describing: error?.localizedDescription))")
226226
} else if data != nil && response != nil {
227227
let responseBody = String(data: data!, encoding: .utf8)
228-
self.delegate?.debugLog?(message: "Bad response from server: \(response!) with body: \(responseBody)")
228+
self.delegate?.debugLog?(message: "Bad response from server: \(response!) with body: \(String(describing: responseBody))")
229229
} else {
230230
self.delegate?.debugLog?(message: "Bad response from server when trying to modify subscription to interest: \(interest)")
231231
}

Source/PusherConnection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ open class PusherConnection: NSObject {
704704

705705
guard let httpResponse = response as? HTTPURLResponse, (httpResponse.statusCode == 200 || httpResponse.statusCode == 201) else {
706706
let dataString = String(data: data, encoding: String.Encoding.utf8)
707-
print ("Error authorizing channel [\(channel.name)]: \(dataString)")
707+
print ("Error authorizing channel [\(channel.name)]: \(String(describing: dataString))")
708708
self.handleAuthorizationError(forChannel: channel.name, response: response, data: dataString, error: nil)
709709
return
710710
}

0 commit comments

Comments
 (0)