Objective-C
Objective-C
Clear All Multipart Parts
See more REST Examples
Demonstrates Rest.ClearAllParts, which removes all multipart subparts from the request under construction.
Background. Clearing the parts is useful when reusing the same Rest object to build a different multipart request.
Chilkat Objective-C Downloads
#import <CkoRest.h>
BOOL success = NO;
CkoRest *rest = [[CkoRest alloc] init];
BOOL bTls = YES;
BOOL bAutoReconnect = YES;
success = [rest Connect: @"example.com" port: [NSNumber numberWithInt: 443] tls: bTls autoReconnect: bAutoReconnect];
if (success == NO) {
NSLog(@"%@",rest.LastErrorText);
return;
}
// Build a part.
rest.PartSelector = @"1";
success = [rest SetMultipartBodyString: @"value1"];
if (success == NO) {
NSLog(@"%@",rest.LastErrorText);
return;
}
// Remove all multipart subparts from the request under construction, for example before reusing the
// same Rest object for a different multipart request.
[rest ClearAllParts];
NSLog(@"%@",@"All multipart parts cleared.");