gpt4 book ai didi

iphone - FBWebDialog 在 iOS 7 中出现时消失

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:03:12 24 4
gpt4 key购买 nike

当 FBWebDialog 在 iOS 7 中出现时,它会随着闪光消失。如果我重新启动应用程序,它就会显示出来。它在 iOS 5 和 iOS 6 中正确显示。我在 iOS 7 中遇到这种奇怪的行为。我应该怎么做才能解决这个问题。我正在使用 Facebook SDK 3.7.1。

 -(void)facebookShareButtonClicked{ 

NSArray *permissions = [NSArray arrayWithObjects: @"publish_stream", nil];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:link,@"link",subject,@"caption",description,@"description",nil];
if(OS_VERSION >= 6.0){
[FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError* error){
if(!error){
[self displayShareDialogueBox:params];
}
else{
NSLog(@"error=>%@",[error localizedDescription]);
}
}
else{
[self displayShareDialogueBox:params];
}
}

-(void)displayShareDialogueBox:(NSDictionary*)params{

[FBWebDialogs presentFeedDialogModallyWithSession:(OS_VERSION >= 6.0)?FBSession.activeSession:nil
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or publishing a story.
NSLog(@"Error publishing story.");
}
else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User clicked the "x" icon
NSLog(@"User canceled story publishing.");
}
else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:@"post_id"]) {
// User clicked the Cancel button
NSLog(@"User canceled story publishing.");
} else {
// User clicked the Share button
NSString *msg = [NSString stringWithFormat:
@"Posted story, id: %@",
[urlParams valueForKey:@"post_id"]];
NSLog(@"%@", msg);
// Show the result in an alert
[[[UIAlertView alloc] initWithTitle:@"Result"
message:msg
delegate:nil
cancelButtonTitle:@"OK!"
otherButtonTitles:nil]
show];
}
}
}
}];
}

谢谢

最佳答案

只需安装 facebook 发布的支持 iOS 7 的最新 Facebook SDK 包 v 3.8。无需对代码进行任何更改。一切都会好起来的。它对我有用。

关于iphone - FBWebDialog 在 iOS 7 中出现时消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18824222/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com