当我试图通过我的应用程序实现FBSDKShareDialog来实现facebook共享时,我遇到了一些麻烦。如果安装了官方的fb应用程序,它会显示空白对话框(用户允许输入一些文本等)。如果用户没有fb应用程序,它会显示正确的信息,但是FBSDKSharingDelegate方法不起作用。(即使用户有fb应用程序,它也不起作用)
- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results
{
NSLog(@"complete");
}
- (void)sharerDidCancel:(id<FBSDKSharing>)sharer
{
NSLog(@"did cancel");
}
- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error
{
NSLog(@"%@", error);
}它从来没有被调用,即使当我取消或分享通过FB申请。我的代码是:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentTitle = _place.title;
content.imageURL = [NSURL URLWithString:_place.logoUrl];
content.contentDescription = _place.info;
[FBSDKShareDialog showFromViewController:_viewController withContent:content delegate:self];在@interface声明中有一个委托。
@interface FacebookHandler () < FBSDKSharingDelegate >
@end我的应用程序代表
#import <FBSDKCoreKit/FBSDKCoreKit.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return [[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}我哪里错了?通过FBSDKShareLinkContent发布一些图片和标题是个好主意。提前谢谢。
发布于 2015-10-05 11:47:37
我已经解决了这个问题。问题是我要委托从NSObject继承的文件,它不能是委托
发布于 2015-10-05 11:40:12
您是从主线程调用[FBSDKShareAPI shareWithContent:content delegate:self]吗?
https://stackoverflow.com/questions/32890722
复制相似问题