我有我的ios應用程序一年的Facebook分享工作正常,並已升級(又名完全重寫)使用最新的api(4.7.x),現在分享不起作用。我檢查了我是否擁有publish_actions權限(我在調用此方法之前執行了此操作,在開放圖形設置,操作類型和功能中檢查了'expicitly shared'。我正在驗證內容(我沒有收到錯誤)並擁有代表,沒有它的方法被調用。ios非對話Facebook分享失敗,沒有錯誤,也沒有反饋
-(void)shareWithFacebook:(NSString *)message
{
if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"])
{
NIDINFO(@"Facebook sharing has publish_actions permission");
}
else
{
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
[loginManager logInWithPublishPermissions:@[@"publish_actions"]
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
NIDERROR(@"Facebook sharing getting publish_actions permission failed: %@", error);
}
];
}
NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithDictionary: @{
@"og:type": @"article",
@"og:title": @"Bloc",
@"og:description": message,
@"og:url": @"http://getonbloc.com/download"
}];
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
// Create the action
FBSDKShareOpenGraphAction *action = [FBSDKShareOpenGraphAction actionWithType:@"mynamespace:Share" object:object key:@"article"];
[action setString:@"true" forKey:@"fb:explicitly_shared"];
// Create the content
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"article";
// Share the content
FBSDKShareAPI *shareAPI = [[FBSDKShareAPI alloc] init];
shareAPI.shareContent = content;
shareAPI.delegate = self;
NSError *error;
if([shareAPI validateWithError:&error] == NO)
{
NIDERROR(@"Facebook sharing content failed: %@", error);
}
[shareAPI share];
}
#pragma mark - FBSDKSharingDelegate
- (void) sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results
{
NIDINFO(@"Facebook sharing completed: %@", results);
}
- (void) sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error
{
NIDERROR(@"Facebook sharing failed: %@", error);
}
- (void) sharerDidCancel:(id<FBSDKSharing>)sharer
{
NIDINFO(@"Facebook sharing cancelled.");
}
我已經登錄的工作,並能得到精美的照片,我沒有得到任何反饋都來自Facebook的API,沒有被公佈。我是不是特別傻在這裏?
這聽起來像一個錯誤,你可以在https://developers.facebook.com/bugs報告,並附上一個小樣本項目? –