EDIT:
Here is some code to start operations in the background thread. Using any function called from the user interface thread will work in the user interface thread. You can use a technique similar to the one described below to start your operation in the background thread, and then send the result back to the user interface thread for later use.
Here is the technique I used, you can replace my sendSynchronousRequest request with your AFHTTPRequestOperation :
Specify a special type (block) so that you can pass blocks of code.
typedef void (^NetworkingBlock)(NSString* stringOut);
Then you need to send the background thread so as not to freeze the UI thread.
Here you can call the material in the background thread, and then wait for an answer, and then call the block when it is executed without using the user interface thread to do this:
- (void) sendString:(NSString*)stringIn url:(NSString*)url method:(NSString*)method completion:(NetworkingBlock)completion {
Use it as follows:
- (void) myFunction { [self sendString:@"some text in the body" url:@"http://website.com" method:@"POST" completion:^(NSString *stringOut) {
source share