Search code examples
iphoneobjective-csocketsfunctionpushviewcontroller

Why I am unable to push viewcontroller to the next viewcontroller?


I am working on sockets in objective-c so i wrote a function for getting response of server when my condition comes true i want to push to the next view controller but it is not pushing or presenting plz help some code is given here

this is my function

void receiveData(CFSocketRef s, 
       CFSocketCallBackType type,  
       CFDataRef address, 
       const void *data, 
       void *info)
{
    LoginViewController *lvc = [[LoginViewController alloc] init];

    char *buffer = (char *)CFDataGetBytePtr((CFDataRef)data);

    if (strstr(buffer, "LCNF|ACPT") == NULL)
    { 
        NSLog(@"%@",data);
        [lvc alert];
    }
    else

        [lvc goToWatchList];
}

my "goToWatchlist" method is:

-(void)goToWatchList
{

    WatchListViewController *wlController = [[WatchListViewController alloc] initWithNibName:@"WatchListViewController" bundle:nil];
    [self presentModalViewController:wlController animated:YES];
    [wlController release];
}

Thanx in advance


Solution

  • I have done something very similar before. Are you sure it even reaches your [lvc goToWatchList]; within receiveData? Also check that your reading from socket is not blocking the thread!

    Also check your xib file - if this cannot be found it won't appear either... (Ups - already been mentioned while I was typing...)