我遇到的问题是,在用户点击FBDialog的“共享”按钮后,他们在请求完成或失败之前不会得到任何视觉反馈......并且在3G上可能需要一段时间。在此期间,用户不知道他们是否正确点击“分享”,并且存在两次发布内容的风险。
有没有办法可以获得回调,所以我可以在这段时间内显示加载指示符?我应该把这件作品放在哪里?
谢谢!
答案 0 :(得分:1)
在下面的代码中你写入fbAgent.m并在这里观察代码你在那时得到一个“PID”你写入警告消息.......用户可以理解msg是成功发布Facebook。
我希望这会有所帮助。
- (void)request:(FBRequest*)request didLoad:(id)result {
if ([request.method isEqualToString:@"facebook.fql.query"]) {
NSArray* users = result;
NSDictionary* user = [users objectAtIndex:0];
NSString* name = [user objectForKey:@"name"];
// Calling the delegate callback
[delegate facebookAgent:self didLoadName:name];
} else if ([request.method isEqualToString:@"facebook.users.setStatus"]) {
newStatus = nil;
NSString* success = result;
if ([success isEqualToString:@"1"]) {
// Calling the delegate callback
[delegate facebookAgent:self statusChanged:YES];
} else {
[delegate facebookAgent:self statusChanged:NO];
}
} else if ([request.method isEqualToString:@"facebook.photos.upload"]) {
NSDictionary* photoInfo = result;
NSString* pid = [photoInfo objectForKey:@"pid"];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:[NSString stringWithFormat:@"success Uploaded Your image please check your FaceBook", pid] delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok", nil];
[alertView show];
[alertView release];
fbbut.enabled=YES;
[fbact stopAnimating];
self.uploadImageData = nil;
self.uploadImageCaption = nil;
self.uploadImageAlbum = nil;
//[delegate facebookAgent:self photoUploaded:pid];
if(newStatus){
[self setStatus:newStatus];
}
}
}
答案 1 :(得分:-1)
当您点击按钮并停止代表Facebook功能
时启动您的指示器- (void)dialogDidComplete:(FBDialog *)dialog
希望它有所帮助......