S
S
Solo322015-11-10 02:33:23
Classmates
Solo32, 2015-11-10 02:33:23

Bug report iOS SDK. Why is everything so bad?

Request to create a photo album using the iOS SDK:

OKRequest *req = [Odnoklassniki requestWithMethodName:@"photos.createAlbum" params:params httpMethod:@"post" delegate:self];
        [req executeWithCompletionBlock:^(id data){
            NSLog(@"Created album %@", data);
..................

And data is null here , although, according to the documentation , the ID of the created album should come. And all why?
Because a regular UTF8 string comes in (for example) <22383132 31323637 34323537 3622>
which in OKRequest.m, line 98, is parsed as JSON :
- (void)handleResponse:(NSMutableData *)data {
    NSError *jsonParsingError = nil;
    id result;
    if (data) {
        result = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonParsingError];
    }
 ....

Tip for API developers: JSON looks like this {"12345"}, not like this "12345"
and result is null .
Do not be offended, but this is not an SDK, but shitcode. I spat while working with this shit, I hope I never have to again.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question