URLSession.shared.dataTaskPublisher not working on IOS 13.3

后端 未结 3 401
北恋
北恋 2020-12-03 23:36

When trying to make a network request, I\'m getting an error

finished with error [-999] Error Domain=NSURLErrorDomain Code=-999 \"cancelled\"
3条回答
  •  情歌与酒
    2020-12-04 00:41

    I needed to move my cancellable set "above" the scope of the function where my subscriber was executing. This worked fine in iOS 13.2 when the cancellable set had the same scope as the function of the subscriber, but stop working in 13.3. The dataTaskPublisher cancels with the error sited above. It makes sense that the cancellable set should "out live" the subscriber. Developer error. Lesson learned.

提交回复
热议问题