Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8796821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:42:36+00:00 2026-06-13T23:42:36+00:00

When tap the play button, it crashes in Xcode with message Thread 6 GCDAsyncSocket

  • 0

When tap the play button, it crashes in Xcode with message “Thread 6 GCDAsyncSocket 0 objc_msgSend”. Some times it just works, but most of the time I got this error. Any clue?

Snapshot: https://i.stack.imgur.com/EvpnK.png

Below are the code lines:

- (void)viewDidLoad {
    [self initSocket];
}

-(void) initSocket
{
    dispatch_queue_t mainQueue =  dispatch_get_main_queue();
    asyncSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:mainQueue];
    [self connectToVLC];
}

-(void) connectToVLC
{
    NSString *host = @"192.168.0.8";
    uint16_t port = 8080;
    NSError *error = nil;

    if (![asyncSocket connectToHost:host onPort:port error:&error]){
        NSLog(@"unable connect to VLC server");
    }else{
        NSLog(@"connected to VLC server");
    }
}

-(IBAction) btnPlayTapped
{
    [self writeCommand:@"stop" tag:TAG_NONE];
    [self writeCommand:@"repeat off" tag:TAG_NONE];
    [self writeCommand:@"loop off" tag:TAG_NONE];
    [self writeCommand:@"add /abc.wav" tag:TAG_NONE];
    [self writeCommand:@"play" tag:TAG_PLAY];
}

-(void) writeCommand:(NSString *)cmd tag:(long)theTag
{
    NSMutableData *data = [NSMutableData dataWithData:[cmd dataUsingEncoding:NSUTF8StringEncoding]];
    [data appendData:[GCDAsyncSocket CRLFData]];
    [asyncSocket writeData:data  withTimeout:-1 tag:theTag];
}


- (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag
{
    if(tag==TAG_PLAY){
        //handle rest operation here
    }
}

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:42:37+00:00Added an answer on June 13, 2026 at 11:42 pm

    Resolved by retain the data object in writeCommand method:

    -(void) writeCommand:(NSString *)cmd tag:(long)theTag
    {
        NSMutableData *data = [NSMutableData dataWithData:[cmd dataUsingEncoding:NSUTF8StringEncoding]];
        [data appendData:[GCDAsyncSocket CRLFData]];
        [data retain];//release it in dealloc
        [asyncSocket writeData:data  withTimeout:-1 tag:theTag];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have firstViewController and SecondViewController . In both controllers I can tap play button
Is there an event that I can tap into in Global.asax to execute some
I have a button that when i tap on it i want to invoke
I'm adding subviews with tap gestures: from UIView class(masterButton): [self addSubview:self.button]; // Add gesture
I want to play some sound effects while animating an UI element (e.g. playing
I bough a cheap RFID reader from eBay, just to play about with. There
I am doing just for fun a virtual desktop to play Magic The Gathering
After tap some row in UITableView apps goes to new screen. I can replace
I have a viewContoller holding MPMoviePlayerController. Everything is working fine but just one thing
I am using AVAudioRecorder .if I tap on record button,The recording should start/save only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.