swift – iOS Pocket API has points on getting gadgets?

0
20
swift – iOS Pocket API has points on getting gadgets?


My app, Voicepaper, has a function to retrieve gadgets from Pocket, and up till a couple of days in the past, it was working positive utilizing the Pocket API.

Even now, the authentication course of is functioning usually, and I haven’t modified any code.

Nevertheless, beginning a couple of days in the past, when attempting to retrieve gadgets from Pocket, there was no response.

It appears extremely possible that there’s a difficulty on Pocket’s API aspect. May you please examine this?

By the best way, even customers who’re nonetheless on iOS 17 are experiencing the identical problem.

Right here is the SDK I’ve been utilizing, which was working positive till not too long ago:
https://github.com/Pocket/Pocket-ObjC-SDK

PS:
I already contacted to Pocket and Pocket API helps, they usually stated there isn’t any assist for API no extra, and I ought to ask about this on StackOverFlow of Github which is at present closed.

Right here is the error code:
DEBUG: Sending request to Pocket API with arguments: [“sort”: “newest”, “since”: “”, “state”: “unread”, “count”: “200”]
DEBUG: Acquired response from Pocket API
DEBUG: HTTP Standing Code: -1
DEBUG: Response: nil
DEBUG: Error: No error

And right here’s the Swift code used to load gadgets:

@objc func loadPocketItems() {

HUD.present(.progress)
let arguments = getCurrentArguments()

print("DEBUG: Sending request to Pocket API with arguments: (arguments)")

PocketAPI.shared().callMethod("get", with: PocketAPIHTTPMethodGET, arguments: arguments) { _, httpResponse, response, error in
HUD.cover()
if self.refresher.isRefreshing {
self.refresher.endRefreshing()
}

print("DEBUG: Acquired response from Pocket API")
print("DEBUG: HTTP Standing Code: ((httpResponse as? HTTPURLResponse)?.statusCode ?? -1)")
print("DEBUG: Response: (response as Any)")
print("DEBUG: Error: (error?.localizedDescription ?? "No error")")

if let error = error {
VPAlertManager.showErrorMessage(vc: self, message: "API Error: (error.localizedDescription)")
return
}

guard let response = response as? [String: Any] else {
VPAlertManager.showErrorMessage(vc: self, message: "Response is empty or invalid")
return
}

let json = JSON(response)
let checklist = json["list"]
if checklist.isEmpty {
VPAlertManager.showErrorMessage(vc: self, message: "Checklist is empty")
return
}

if let itemList = response["list"] as? [AnyHashable: Any] {
self.pocketItems = VPPocketManager.sortItems(vc: self, itemList: itemList)
self.pocketItems = self.pocketItems.reversed()
self.tableView.reloadData()

// Monitor Used As soon as
let key = "Pocket Used"
if !UserDefaults.commonplace.bool(forKey: key) {
Mixpanel.mainInstance().observe(occasion: key)
UserDefaults.commonplace.set(true, forKey: key)
}
} else {
VPAlertManager.showErrorMessage(vc: self, message: "Invalid response format")
}
}
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here