It's possible that the session delegate's method is being invoked on a background thread. UIKit calls should only be made on the main thread, so you may need to move your code that interacts with UIKit to another method like this:
- (void) updateUI {
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];
}
and then call it using:
-(void)session:(MCSession *)session didStartReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID withProgress:(NSProgress *)progress
{
NSLog(@"RECEIVING... %@ from peer: %@", progress, peerID);
[self performSelectorOnMainThread:@selector(updateUI) withObject:nil waitUntilDone:YES];
}