wordpress-mobile / wpxmlrpc

A lightweight XML-RPC encoder/decoder for iOS, OS X, and tvOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Response data

keithslater opened this issue · comments

Can you explain where the response data comes from in your sample? I'm assuming a delegate but I'm not sure.

responseData is the data the server sent, and it'll depend on how you do networking.
Here's one example using AFNetworking
https://github.com/koke/WordPressApi/blob/master/WordPressApi/WPXMLRPCClient.m#L121

I have implemented WPXMLRPC and the file I'm trying to send to WordPress is loaded in the Cache directory successfully. How do I actually send it? I have NetworkManager.h in my project and was using Czarny's XMLRPC before, but larger files were crashing my app. What do I do now after this ...

    [request setHTTPBodyStream:inputStream];
    [request setValue:[NSString stringWithFormat:@"%lu", contentLength] forHTTPHeaderField:@"Content-Length"];

Any help is greatly appreciated!

It depends on how you do networking, but the most basic way using NSURLSession would look something like this:

 NSURLSession *session = [NSURLSession sharedSession];
 NSURLSessionDataTask *task = [session dataTaskWithRequest:request
                                         completionHandler:
     ^(NSData *data, NSURLResponse *response, NSError *error) {
         // Do something with the response data...
     }];

 [task resume];

Closing due to inactivity.