nmdias / FeedKit

An RSS, Atom and JSON Feed parser written in Swift
MIT License
1.19k stars 173 forks source link

Failure with URL on Apple Watch (real device) #119

Open furiosFast opened 4 years ago

furiosFast commented 4 years ago

Hi, first of all, great job!!!

I have encountered a problem that occurs only when I try to parse an RSS feed on Apple Watch device (on simulator it works). the feed has the following url: http://www.servizitelevideo.rai.it/televideo/pub/rss101.xml

FeedKit always fail on this try: data = try Data (contentsOf: sanitizedSchemeUrl) If run the exact same code on iPhone it works. Of course, even if I download the Data with Alamofire and then I pass it to FeedKit

mlm249 commented 3 years ago

I ran into a similar problem. I read somewhere that Data(contentsOf: ) under the hood works with something not watch friendly. Sure enough, obtaining my Data from URLSession instead worked for me. This way you can use the FeedParser(data: Data) initializer. It would be nice if the FeedParser(url: URL) initializer had a fallback to URLSession on watchOS though