Objective C
Objective C - NSURL Session
#import <Foundation/Foundation.h>
NSDictionary *parameters = @{ @"token": @"c2a0b6221c5dd55ceb09ae1f74e46521756d",
@"priority ": @0,
@"application": @"2",
@"sleep": @0,
@"globalmessage": @"",
@"globalmedia": @"",
@"data": @[ @{ @"number": @"1212", @"message": @"Test" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://pickyassist.com/app/api/v2/push"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
Last updated