iOS发布失败,没有错误logging
我试图使用他们的iOS游戏教程中的代码分享到Facebook。 popup对话框,我指定的图像和文本是存在的,但是当我点击“发送”加载栏出现,不加载,然后我被redirect到我的应用程序。 没有错误打印到控制台,应用程序不会崩溃。
当我在Facebook上检查邮件是否已经发布时,我得到以下信息:
“糟糕,有些东西出错了,发布状态时出现问题,我们logging了错误,并将查看它。
我已经在以前的应用程序中使用这个代码,它工作得很好。 我已经在plist中更新了Facebook ID,Facebook显示名称和URL Scheme。
这里是代码:
FacebookHandler类(来自Facebook教程)
#import "FacebookHandler.h" @implementation FacebookHandler + (void) Facebook_CreateNewSession { // initialize Facebook FBSession* session = [[FBSession alloc] init]; [FBSession setActiveSession: session]; } + (void) Facebook_Login { NSArray *permissions = [[NSArray alloc] initWithObjects: @"email", nil]; // Attempt to open the session. If the session is not open, show the user the Facebook login UX [FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:true completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { // Did something go wrong during login? Ie did the user cancel? if (status == FBSessionStateClosedLoginFailed || status == FBSessionStateCreatedOpening) { // If so, just send them round the loop again [[FBSession activeSession] closeAndClearTokenInformation]; [FBSession setActiveSession:nil]; [self Facebook_CreateNewSession]; } else { } }]; } + (void) Facebook_PostToNewsFeedWithTitle:(NSString*)title withCaption:(NSString*)caption withDescription:(NSString*)description withLink:(NSString*)link withPictureURL:(NSString*)picURL { // check if user is logged in if ([FBSession activeSession] == nil) { [FacebookHandler Facebook_CreateNewSession]; [FacebookHandler Facebook_Login]; } // This function will invoke the Feed Dialog to post to a user's Timeline and News Feed // It will attemnt to use the Facebook Native Share dialog // If that's not supported we'll fall back to the web based dialog. NSString *linkURL = link; NSString *pictureURL = picURL; // Prepare the native share dialog parameters FBShareDialogParams *shareParams = [[FBShareDialogParams alloc] init]; shareParams.link = [NSURL URLWithString:linkURL]; shareParams.name = title; shareParams.caption= caption; shareParams.picture= [NSURL URLWithString:pictureURL]; shareParams.description = description; if ([FBDialogs canPresentShareDialogWithParams:shareParams]){ [FBDialogs presentShareDialogWithParams:shareParams clientState:nil handler:^(FBAppCall *call, NSDictionary *results, NSError *error) { if(error) { NSLog(@"Error publishing story."); } else if (results[@"completionGesture"] && [results[@"completionGesture"] isEqualToString:@"cancel"]) { NSLog(@"User canceled story publishing."); } else { NSLog(@"Story published."); } }]; }else { // Prepare the web dialog parameters NSDictionary *params = @{ @"name" : shareParams.name, @"caption" : shareParams.caption, @"description" : shareParams.description, @"picture" : pictureURL, @"link" : linkURL }; // Invoke the dialog [FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:params handler: ^(FBWebDialogResult result, NSURL *resultURL, NSError *error) { if (error) { NSLog(@"Error publishing story."); } else { if (result == FBWebDialogResultDialogNotCompleted) { NSLog(@"User canceled story publishing."); } else { NSLog(@"Story published."); } }}]; } } @end
我的电话
[FacebookHandler Facebook_PostToNewsFeedWithTitle:title withCaption:caption withDescription:description withLink:link withPictureURL:picURL];
UPDATE
这似乎是一个Facebook应用程序的问题。 在卸载Facebook的设备上尝试时,系统会要求我login,然后成功发布。 但是,如果Facebook安装,它不会发布。
我通过在plist文件中手动input“URL types”键来修复它。 不要复制粘贴从另一个plist文件plist值 – 这是苹果的错误!
- SLComposeViewController不会为SLServiceTypeFacebook设置initialText
- FBSDKLoginManager logInWithPublishPermissions总是返回isCancelled = YES
- 如何在单个iOS应用程序中使用多个Facebook应用程序ID?
- 在iOS iOS SDK v4.0中可靠地检查应用程序启动时的活动会话
- Facebook的iOS SDK:为什么我得到“你必须升级这个应用程序graphicsAPI v2.x”?
- 通过Facebook iOS SDK获取我所有的活动
- 如何通过点击Swift中的button来打开fb和instagram应用程序
- 使用会话处理Facebook iOS中的取消button
- Facebook连接后对话框文本?