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”.
urlToPost
Where to make the HTTP request to.
postData
Data to send along for post requests.
contentType
Content type to be used in HTTP headers.
seconds
Timeout to apply to the request, in milliseconds. The Request must be cancelled after that amount of time has passed.
headerFieldType
Fields to be added in HTTP header request.
completionHandler
completion handler to be implemented for HTTP responce,error.
headerFieldValue
Value 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()