I was finally able to compile libssh2 (thanks to a very helpful forrst'r), but now I keep seeing the `EXC_BAD_ACCESS` error.
This is the basic background as to how libssh2 works (at least the GUI) is this...
Now, simple commands like `echo Hello World` work fine, but the whole idea of this as a project was to be able to restart my mac remotely. Originally, using the command `shutdown -r` caused nothing to happen on the remote machine, and crashed the app. I then had the idea that I could simple open an applescript app that restarts the mac, by using the `open /path/to/restart.app` command, which works fine. The machine restarts, sweet.
EXCEPT, the app crashes with the following error:
I'm really new to objective-c, and I have no idea how to go about fixing this. Looking it up on google, I've found that it's caused by:
So, I'm guessing that once the command is sent via SSH, it disconnects and then tires to show the result but the object's already gone.
I'd post the source code for this, but it's a lot of different files, so I'll post the github link:
https://github.com/x2on/libssh2-for-iOS
I have not modified any of the code, so if anyone has the desire to replicate my problem, the code I'm using is the same as the one from there.
EDIT: From another forum, "... having said that you can see that libssh2_channel_open() is dereferencing a NULL pointer so you're likely passing one of the parameters as NULL. Stick a breakpoint on your call to libssh2_channel_open_ex() and check the parameters as they go in; alternatively add asserts before the call to ensure things are as you expect (a better longterm solution)." How do I follow these instructions?
This is the basic background as to how libssh2 works (at least the GUI) is this...
- Enter command
- Enter host IP
- Enter username/pass
- Press the button to send the SSH command
Now, simple commands like `echo Hello World` work fine, but the whole idea of this as a project was to be able to restart my mac remotely. Originally, using the command `shutdown -r` caused nothing to happen on the remote machine, and crashed the app. I then had the idea that I could simple open an applescript app that restarts the mac, by using the `open /path/to/restart.app` command, which works fine. The machine restarts, sweet.
EXCEPT, the app crashes with the following error:
Code:
Thread 1: EXC_BAD_ACCESS (code=1, address=_____)
I'm really new to objective-c, and I have no idea how to go about fixing this. Looking it up on google, I've found that it's caused by:
- Memory issue
- Message being sent to an object that's already been released (I'm not sure what this means...)
So, I'm guessing that once the command is sent via SSH, it disconnects and then tires to show the result but the object's already gone.
I'd post the source code for this, but it's a lot of different files, so I'll post the github link:
https://github.com/x2on/libssh2-for-iOS
I have not modified any of the code, so if anyone has the desire to replicate my problem, the code I'm using is the same as the one from there.
EDIT: From another forum, "... having said that you can see that libssh2_channel_open() is dereferencing a NULL pointer so you're likely passing one of the parameters as NULL. Stick a breakpoint on your call to libssh2_channel_open_ex() and check the parameters as they go in; alternatively add asserts before the call to ensure things are as you expect (a better longterm solution)." How do I follow these instructions?