CISHTTPProtocol
@protocol CISHTTPProtocol <NSObject>
Class conforming to this will be responsible for implementing required methods for HTTP(s) tasks, this is used by the Conviva library to make HTTP(S) requests.
-
-makeRequestWithurl:data: timeoutSeconds: httpMethod: contentType: httpHeaderValue: httpHeaderField: completionHandler: Send an HTTP request. HTTPS should be handled as well.
Will be called regularly when Conviva monitoring sessions are active.
The class implementing needs to notify response back with callbackSelector on callbackDelegate with parameters.
Parameter 1 : (NSString *)responseString.
Parameter 2 : error:(NSString *)error.
Parameter 3 : delegate:(id< CISCancelProtocol >)requestDelegate. This will be used by SDK to cancel current HTTP tasks so class implementing CISHTTPProtocol must implement CISCancelProtocol required method.
Parameter 4 : context:(id)context not required can be set nil.Declaration
Objective-C
- (void)makeRequestWithurl:(NSURL *)urlToPost data:(NSString *)postData timeoutSeconds:(NSTimeInterval)seconds httpMethod:(NSString *)httpMethod contentType:(NSString *)contentType httpHeaderValue:(NSString *)headerFieldValue httpHeaderField:(NSString *)headerFieldType completionHandler: (void (^)(NSData *, NSURLResponse *, NSError *))completionHandler;Swift
func makeRequestWithurl(_ urlToPost: URL!, data postData: String!, timeoutSeconds seconds: TimeInterval, httpMethod: String!, contentType: String!, httpHeaderValue headerFieldValue: String!, httpHeaderField headerFieldType: String!, completionHandler: ((Data?, URLResponse?, Error?) -> Void)!)Parameters
httpMethod“POST” or “GET”.
urlToPostWhere to make the HTTP request to.
postDataData to send along for post requests.
contentTypeContent type to be used in HTTP headers.
secondsTimeout to apply to the request, in milliseconds. The Request must be cancelled after that amount of time has passed.
headerFieldTypeFields to be added in HTTP header request.
completionHandlercompletion handler to be implemented for HTTP responce,error.
headerFieldValueValue for fields to be added in HTTP header request.
-
Notification that Conviva no longer needs this HttpProtocol object.
Declaration
Objective-C
- (void)cleanUp;Swift
func cleanUp()
CISHTTPProtocol Protocol Reference