Reputation: 227
I use this code to share to facebook:
[appDelegate.facebook dialog:@"feed" andParams:params andDelegate:appDelegate];
How can i get the notification (like sharekit) when sharing is successful?
I want to show UIAlertView but i do not know which facebook method that i need to put the UIAlertView.
I try in this method:
- (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];
}
It is working however, when i click cancel button, this method is also called. So where is the right one to put the success alert view?
Upvotes: 0
Views: 379
Reputation: 1447
I am new in IOS. These are changes i made in 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];
}
Upvotes: 2