These are two methods I have:
-(void)session:(MCSession *)session didStartReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID withProgress:(NSProgress *)progress
{
NSLog(@"RECEIVING... %@ from peer: %@", progress, peerID);
[self performSelectorOnMainThread:@selector(updateUIWithPeerId:) withObject:nil waitUntilDone:YES];
}
- (void) updateUIWithPeerId:(MCPeerID *)peerID {
UIProgressView *progressBar = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
progressBar.frame = CGRectMake(0, 200, 100, 20);
progressBar.progress = 0.5;
//UIButton* btn = [BluetoothDeviceDictionary objectForKey:peerID];
[self.view addSubview:progressBar];
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"Alert View Title" message:@"Alert View Text" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[alertView show];
}
The first calls the second with this code:
[self performSelectorOnMainThread:@selector(updateUIWithPeerId:) withObject:nil waitUntilDone:YES];
But I want to pass on to the second method this variable: peerID. Usually I would do:
[self updateUIWithPeerId: peerID];
but I can't do it in performSelectorOnMainThread