2011-12-21 45 views
0

我使用此代碼分享至Facebook:Facebook連接圖形API得到通知時,成功分享給Facebook

[appDelegate.facebook dialog:@"feed" andParams:params andDelegate:appDelegate];  

我怎樣才能得到通知(如sharekit)時,共享是成功的?

我想顯示UIAlertView,但我不知道我需要把UIAlertView的Facebook方法。

我嘗試這個方法:

- (void)dialogDidSucceed:(NSURL *)url { 

if ([_delegate respondsToSelector:@selector(dialogCompleteWithUrl:)]) { 
    [_delegate dialogCompleteWithUrl:url]; 
} 


UIAlertView * alert=[[UIAlertView alloc] 
        initWithTitle: @"Sharing to Facebook" 
        message: @"Success" 
        delegate:self 
        cancelButtonTitle:@"Close" 
        otherButtonTitles:nil, nil]; 


[self setAlertSuccess:alert]; 
[alertSuccess show]; 
[alert release]; 

NSLog(@"SUCCESS 2"); 
[self dismissWithSuccess:YES animated:YES]; 
} 

然而工作,當我點擊取消按鈕,這種方法也被稱爲。那麼把成功警報視圖放在哪裏是正確的?

回答

2

我是IOS新手。 這些是我在FBDialog.m中所做的更改

- (void)dismissWithSuccess:(BOOL)success animated:(BOOL)animated { 
    if (success) { 
     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook Login Sucessful!" message:@"" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
     [alert show]; 
     [alert release]; 
     if ([_delegate respondsToSelector:@selector(dialogDidComplete:)]) { 
      [_delegate dialogDidComplete:self]; 



     } 
    } else { 
     if ([_delegate respondsToSelector:@selector(dialogDidNotComplete:)]) { 
      [_delegate dialogDidNotComplete:self]; 
     } 
    } 

    [self dismiss:animated]; 
}