TheM4hd1 / SwiftyInsta

Instagram Private API Swift
MIT License
225 stars 51 forks source link

Get Followers completionHandler never gets called #137

Closed anonrig closed 4 years ago

anonrig commented 4 years ago

Hi @TheM4hd1

It seems that the followers request completion handler never gets called. My code is as follows:

    func getMyFollowers() -> Observable<[User]>{
        return Observable.create { observer in
            self.handler.users.following(user: .me, with: .init(maxPagesToLoad: .max), updateHandler: nil, completionHandler: { (response, _) in
                switch response {
                case .success(let users):
                    observer.onNext(users)
                    observer.onCompleted()
                case .failure(let error):
                    observer.onError(error)
                    observer.onCompleted()
                }
            })

            return Disposables.create()
        }
    }
anonrig commented 4 years ago

It seems that if I set the maxPagesToLoad to 1 it works, but other than that the issue is pagination.

anonrig commented 4 years ago

@sbertix The same issue appears also on

self.handler.media.by(user: .primaryKey(userId), with: .init(maxPagesToLoad: .max)

sbertix commented 4 years ago

Yep. I've caught the same issue today.
It's definitely a big bug with 2.2. I'm fixing it rn.