我正尝试将iOS应用程序与Facebook集成。登录和大部分功能都能正常工作,但当我试图让FBWebDialogs共享用户发布的内容时,我遇到了一个小问题。如果在发布(调用函数)之后直接调用它,但是当我尝试从警报视图执行相同操作时崩溃,它会很好地工作,它会刚刚开始出现,并在完全加载之前突然消失,而不会中断应用程序并且不会引发错误。它使用iOS 6中的新Facebook功能,当用户登录到iPhone的设置中时,它具有本机视图,而不是FBWebDialogs。 我使用第三方库来定制警报视图,但它与标准警报视图相同。Facebook Web对话框在点击警报视图按钮(iOS)后崩溃
我认为这是解除观点的东西,但没有足够的知识来了解iOS。任何想法?。谢谢。
这是代码:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex)
{
case 1:
{
[self sharePostOnFacebook];
break;
}
default:
break;
}
}
下一个方法的调用,但模式的看法还没有出现,完全出现。它只是闪烁并消失
-(void) sharePostOnFacebook
{
if (shareData !=nil && [[shareData objectForKey:@"success"] boolValue])
{
NSString *caption = [shareData objectForKey:@"caption"];
. ..........
BOOL displayedNativeDialog =
[FBNativeDialogs
presentShareDialogModallyFrom:self
initialText:description
image:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:picture]]]
url:[NSURL URLWithString:link]
handler:^(FBNativeDialogResult result, NSError *error) {
.........
}];
// Fallback, show the view controller that will post using me/feed
if (!displayedNativeDialog)
{
[[[self presentingViewController] presentingViewController] dismissModalViewControllerAnimated:YES];
// Put together the dialog parameters
NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
.............
nil];
FBSession *activeSession = [FBSession activeSession];
// Invoke the dialog
[FBWebDialogs presentFeedDialogModallyWithSession:activeSession
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
........
}];
}
}
}
到目前为止,还有什么运气?我遇到了完全相同的问题。 – markhops