Skip to content

Many crash in TWTRAPIClient #29

@yasuradodo

Description

@yasuradodo

I cannot reproduced the issue, but I got +5k crash reports in this past few hours from our app.

Seems the crash is happened inside of TWTRAPIClient.

- (NSURLRequest *)URLRequestWithMethod:(NSString *)method URLString:(NSString *)URLString parameters:(nullable NSDictionary *)parameters error:(NSError **)error;

My code

private let client: TWTRAPIClient

func friendIds() -> Promise<[String]> {
    Promise { resolver in
        let request = client.urlRequest( // <-- Crashed here
            withMethod: "GET",
            urlString: "https://api.twitter.com/1.1/friends/ids.json",
            parameters: ["stringify_ids": "1"],
            error: nil
        )
        client.sendTwitterRequest(request) { (_, data, error) in
            guard let data = data else {
                let error = error.flatMap {
                    TwitterError(error: $0 as NSError)
                } ?? TwitterError.illegalStateError
                resolver.reject(error)
                return
            }
            do {
                let response = try self.decoder.decode(FriendIdsResponse.self, from: data)
                resolver.fulfill(response.ids)
            } catch {
                resolver.reject(TwitterError(error: error as NSError))
            }
        }
    }
}

log

Does anyone have same issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions