FaceBook UIAlertView problem
- by william-hu
My iPhone application connects to facebook .
After i log in ,then appear one button named "Add feed to your wall".
If i click it , pop a UIAlertView which ask "Yes" or "no". If "Yes", show the FBStreamDialog.
But the BFStreamDialog just flash, then disappear.
I don't know why. this is my code.
First , click the button " Add feed to your wall". call changeFeed: function.
-(IBAction) changeFeed
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sporting Summer Festival Monte-Carlo" message:@"Are you attending this concert?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes",nil];
[alert show];
alert.tag = 1;
self.alertView =alert;
[alert release];
}
Then, if you choose "YES" button. Call this function:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0) {
NSLog(@"NO");
}
else
{
NSLog(@"YES");
[self showAddFeed];
}
}
And this is the showAddFeed function , which is defined in front of "clickButtonAtIndex".
-(void)showAddFeed
{
FBStreamDialog dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.delegate= self;
dialog.userMessagePrompt = @"";
[dialog show];
}
Just cant work well. I don't know why? Thank you for your help.