-2

これを実行したいのですが、'performSelectorOnMainThread:recievedDataSelector' が認識されないセレクタ例外をスローします。

-(void)updateStatus
{   
    [self makeRequest:@"http://someplace.com/blah.php"
       onRecievedData:@selector(updateStatusRecievedData)];
}


-(void)makeRequest:(NSString *)url onRecievedData:(SEL) recievedDataSelector
{
    NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
    [NSURLConnection sendAsynchronousRequest:urlRequest queue:_operationQueue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
     {
             [self performSelectorOnMainThread:recievedDataSelector
                                    withObject:data
                                 waitUntilDone:YES];
     }
}

(void)updateReceivedData:(NSData *) data
{
    NSLog(@"[updateReceivedData]");
}
4

1 に答える 1

2

メソッドに' :' がありませんupdateStatusRecievedData

-(void)updateStatus
{   
    [self makeRequest:@"http://someplace.com/blah.php"
       onRecievedData:@selector(updateStatusRecievedData:)];
}
于 2013-03-28T07:11:47.070 に答える