コードが接続する理由を誰か教えてください
- (IBAction)connectBtn:(id)sender {
socket = [[AsyncSocket alloc] initWithDelegate: self];
[socket connectToHost: @"127.0.0.1" onPort: 4321 error: nil];
}
以下のコードは connecttohost でクラッシュします
- (void)viewDidLoad
{
socket = [[AsyncSocket alloc] initWithDelegate: self];
[super viewDidLoad];
}
- (IBAction)connectBtn:(id)sender {
[socket connectToHost: @"127.0.0.1" onPort: 4321 error: nil];
}
ソケットはview controller.hファイルで定義されています
@interface ViewController : UIViewController{
AsyncSocket *socket;
}