cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
511
Views
0
Helpful
1
Replies

REM Advanced SDK objC

Problem delegate is not called. Connection is established. Input/output streams to host works. But delegates is not called. I have no idea why. I linked all frameworks just like in example app iOSFusionSDKSample and set "enable bitcode" to NO and other linker flags to "-ObjC -lstdc++" and I did try "AssistSDK" it works but i cant control style and size and other options in it.

Code "ViewController.m"

#import "ViewController.h"

@interface ViewController () {

    NSURLSession *session;

}

@end

@implementation ViewController

- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.

}

- (void)viewDidAppear:(BOOL)animated {

    [super viewDidAppear:animated];

   

    NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];

    session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:[NSOperationQueue mainQueue]];

    NSURL *url = [NSURL URLWithString:@"#####"];

    NSURLSessionDataTask *task = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {

       

        NSLog(@"%@", data);

        NSLog(@"%@", response);

        NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

        NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];

       

        NSString *sessionId =  [json valueForKey:@"sessionid"];

       

        ACBUC *uc = [ACBUC ucWithConfiguration:sessionId delegate:self];

        [uc setNetworkReachable:NO];

        [uc acceptAnyCertificate:YES];

        [uc startSession];

        [uc setNetworkReachable:YES];

       

    }];

    [task resume];

}

- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}

- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler

{

    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust] &&[challenge.protectionSpace.host isEqualToString:@"####"])

    {

        NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];

        completionHandler(NSURLSessionAuthChallengeUseCredential, credential);

    }

    else

    {

        completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);

    }

}

- (void)ucDidFailToStartSession:(ACBUC *)uc {

    NSString *string = @"SDFSDF"; // Breakpoint

}

- (void)ucDidLoseConnection:(ACBUC *)uc {

    NSString *string = @"SDFSDF"; // Breakpoint

}

- (void)ucDidReceiveSystemFailure:(ACBUC *)uc {

    NSString *string = @"SDFSDF"; // Breakpoint

}

- (void)ucDidStartSession:(ACBUC *)uc {

    NSString *string = @"SDFSDF"; // Breakpoint

}

@end

Code "ViewController.h"

#import <UIKit/UIKit.h>

#import <ACBClientSDK/ACBUC.h>

#import <ACBClientSDK/ACBClientPhone.h>

#import <ACBClientSDK/ACBClientCall.h>

@interface ViewController : UIViewController <NSURLSessionDelegate, ACBUCDelegate>

@end

Debug LOG output:

ACB client SDK version: 3.2.2.1.1

Scrambled Session ID:#####

Session ID:wss://#####

***WEBSOCKET*** setNetworkReachable: 0

***WEBSOCKET*** NTWK acceptAnyCertificate: 1

Created NSURLRequest: wss://### with timeout of: 7.000000

Waiting for network reachability before websocket is created.

***WEBSOCKET*** setNetworkReachable: 1

Creating websocket to <NSMutableURLRequest: 0x1c001c960> { URL: wss://#### }

SocketRocket: Allowing connection to any root certificate

[SR] Don't Use Cookies

1 Reply 1

Problem solved,

var ACBUC needs to be in class scope not in function scope.

After this little modification it seams to work.

Regards,

Matous