Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXC_BAD_ACCESS #158

Closed
itsoulos opened this issue Dec 1, 2020 · 4 comments
Closed

EXC_BAD_ACCESS #158

itsoulos opened this issue Dec 1, 2020 · 4 comments

Comments

@itsoulos
Copy link

itsoulos commented Dec 1, 2020

I have bridged my app with the library but it gives me the following error constantly

Thread 1: EXC_BAD_ACCESS (code=1, address=0xfffffff9fffbd2ce)
at this line

                 .withLogging(minLogLevel: .debug)

on this code
self.chatHubConnection = HubConnectionBuilder(url: URL(string: self.url)!)
.withLogging(minLogLevel: .debug)
.withAutoReconnect()
.withHttpConnectionOptions(configureHttpOptions: { (httpConnectionOptions) in
if let header = self.headers {
for (key, value) in header {
httpConnectionOptions.headers[key] = value
}
}
})
.withHubConnectionDelegate(delegate: self.chatHubConnectionDelegate!)
.build()

@moozzyk
Copy link
Owner

moozzyk commented Dec 1, 2020

There must be more to the story that is not included here. I don't think the information provided allows to tell what's going on. The client is not allocating memory by itself or dealing with pointers. Here are some details on how to debug EXC_BAD_ACCESS:

I am not sure if I can do more - the line you pointed to is being used in many tests and I have never seen EXC_BAD_ACCESS on this line.

@itsoulos
Copy link
Author

itsoulos commented Dec 1, 2020

The client is starting through Objective C using the following code

signalrswift= [[SignalRSwift alloc ] initWithUrl:signalRString port:self.signalrPort hub:self.signalrHub functionName:self.signalrMessageFunction headers:params];
               
        [signalrswift signalROpenWithBlockfunc: ^(
                                                  NSString * _Nonnull sender,
                                                  NSString * _Nonnull message) {
            NSLog(@"Sender %@ Message %@",sender,message);
            if(self.delegate!=nil)
                [self.delegate onSignalrMessageWithUser:sender andMessage:message];
                 }];

and the client has the following function:

    @objc public func signalROpen(blockfunc:funcBlock!){
      
        self.chatHubConnectionDelegate = ChatHubConnectionDelegate(signalrswift: self)
       
        self.chatHubConnection = HubConnectionBuilder(url: URL(string: self.url)!)
                     .withLogging(minLogLevel: .debug)
                     .withAutoReconnect()
                   .withHttpConnectionOptions(configureHttpOptions: { (httpConnectionOptions) in
                                  if let header = self.headers {
                                      for (key, value) in header {
                                          httpConnectionOptions.headers[key] = value
                                      }
                                  }
                              })
                     .withHubConnectionDelegate(delegate: self.chatHubConnectionDelegate!)
                     .build()
        
        
  self.chatHubConnection!.start()
        self.chatHubConnection!.on(method: self.functionName, callback: {(sender: String, message: String) in
            print("Receive: \(message)")

                blockfunc(sender,message)
           })
        
    
        
        self.chatHubConnection!.on(method: "BroadcastMessage", callback: {(sender: String, message: String) in
            print("Broadcast: \(message)")
               })
 }

@moozzyk
Copy link
Owner

moozzyk commented Dec 1, 2020

Unfortunately, I have never tried using the client from Objective-C. There are a couple issues on Objective-C integration (#37, #13) which contains some advice from people who were able to make it work. Hopefully, they will help you get unblocked.

@moozzyk
Copy link
Owner

moozzyk commented Dec 12, 2020

There is no pending action item for this scenario so I am closing this issue.

@moozzyk moozzyk closed this as completed Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants