-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completion block gets executed twice on failure #6
Comments
Hm… now the same happens with the parserDidEndDocument delegate method. Am I misunderstanding this? |
I think I see what's happening. Yes, it is needed in order to provide error information to the user. However, from what you're telling me and what i've gathered just by quickly looking at it, I'll need to cancel any subsequent errors to the first error found. But I'll take a closer look in the next coming days to determine the most appropriate fix and release a new version. Are you using any public feeds that you could share to better replicate the error? Thanks @mehlkelm! |
I have a workflow where the user can input any URL to subscribe to a feed. First I check if the data at the URL happens to be a valid feed (with FeedKit) which it is most often not. That's where I am running into these errors. Examples I used: tageswoche.ch, zoziapps.ch |
Ok, so it should be fixed now. Great catch by the way, like you said, the call to the completion handler from the delegate methods were indeed causing the issues. Could you check if it's running fine now? Thanks :) |
Looks fine. Thanks for the quick fix! |
If I parse data which happens to not be a valid feed, the completion block gets executed twice.
In Parser.swift, once in line 119 and once in line 242, which is, I believe an XMLParser delegate method. I don't know the FeedKit architecture enough to judge which one is superfluous, though.
One way to reproduce the error: Add this in the sample projects applicationDidFinishLaunching:
let url = URL(string: "https://tageswoche.ch")
URLSession.shared.dataTask(with: url! as URL) { (data, response, error) in
FeedParser(data: data!).parse({ (result) in
print("ERROR")
})
}.resume()
You will see that "ERROR" gets printed twice!
The text was updated successfully, but these errors were encountered: