2015-04-01 4 views
13

I Facebook SDK bin mit 4.0, https://developers.facebook.com/docs/sharing/ios#share_dialog ich FBSDKShareDialog bin mit Photo.It Teilt Foto zu teilen, wenn Benutzer Facebook-App installiert hat Aber es schlägt fehl, wenn Benutzer hasn 'tt FB App installiert. aber sie sagen "Wenn jemand die Facebook App nicht installiert hat, wird automatisch auf einen webbasierten Dialog zurückgegriffen." Idk whats wrong Bitte helfen Sie mir beim Teilen von Fotos mit FBSDK 4.0.FBSDKShareDialog nicht Foto ohne Facebook-App teilen installiert, IOS

Mein Code ist

FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init]; 
photo.image = self.capturedImageView.image; 
photo.userGenerated = YES; 
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init]; 
content.photos = @[photo]; 
[FBSDKShareDialog showFromViewController:self 
          withContent:content 
           delegate:self]; 

Dieser Fehlerbericht ist

enter image description here

error:"com.facebook.sdk:FBSDKErrorArgumentNameKey=shareContent, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Feed share dialogs support FBSDKShareLinkContent."

Antwort

16

FBSDKShareDialog unterstützt nur FBSDKShareLinkContent schreiben Bild oder URL.So Anteil Dialog verwenden Sie haben FBSDKShareLinkContent zu verwenden .

enter image description here

Man könnte es wie folgt verwenden:

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init]; 
    content.imageURL = [NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/3/36/Hopetoun_falls.jpg"]; 
    [FBSDKShareDialog showFromViewController:self 
           withContent:content 
            delegate:self]; 

Wenn Sie einen Link teilen wollen, dann content.contentURL nur verwenden.

Siehe: https://developers.facebook.com/docs/sharing/ios#share_dialog

Wenn Sie FBSDKSharePhoto verwenden, dann müssen Sie die native Facebook für iOS-App installiert ist.

Siehe: https://developers.facebook.com/docs/sharing/ios#photos

+0

Können Sie mir bitte einige Beispiel Link, wie Sie FBSDKSharePhoto verwenden. Ich finde nicht facebook doc ist so hilfreich für mehrere Foto-Sharing –

+0

@Dheeraj FBSDKSharePhotoContent, warum mit diesem ist es nicht möglich. Ich möchte ein Foto vom Bilderwähler hochladen. Warum sollte ich FBSDKShareLinkContent verwenden? Gibt es überhaupt einen FBSDKSharePhotoContent? Vielen Dank im Voraus –

+0

tatsächlich unterstützt FBSDKShareDialog FBSDKSharePhotoContent auch: -/ – 0xDatou

1

ich auch das gleiche Problem wie die Dokumentation hatte auch zu sagen, dass sie Ausweichmechanismen, die für diesen Fall nicht wahr scheint:

Built-In Share Fallbacks

In past versions of the SDK for iOS, your app had to check for a native, installed Facebook app before it could open the Share Dialog. If the person didn't have the app installed, you had to provide your own code to call a fallback dialog.

Now the SDK automatically checks for the native Facebook app. If it isn't installed, the SDK switches people to their default browser and opens the Feed Dialog. If someone wants to share an Open Graph story, the SDK opens the Web Share Dialog.

+2

Ab facebook ios sdk 4.10.0 gibt es immer noch keinen Fallback, wenn keine native Facebook App installiert ist. –

-1

Zuerst konfigurieren Facebook-Account von iOS-Gerät vor und dann folgenden Code verwenden wird es funktionieren:

FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init]; 

photo.image = self.capturedImageView.image; 

photo.userGenerated = YES; 

FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init]; 

content.photos = @[photo]; 

[FBSDKShareDialog showFromViewController:self 
          withContent:content 
           delegate:self]; 
+0

erhalten Fehler Domain = com.facebook.sdk.share Code = 2 "Die Operation konnte nicht abgeschlossen werden. (Com.facebook.sdk.share Fehler 2.)" UserInfo = 0x7faf8e99c8c0 {com.facebook.sdk: FBSDKErrorArgumentValueKey = < FBSDKSharePhotoContent: 0x7faf8dfe7ab0>, com.facebook.sdk: FBSDKErrorDeveloperMessageKey = Feed-Freigabe-Dialoge unterstützen FBSDKShareLinkContent., Com.facebook.sdk: FBSDKErrorArgumentNameKey = shareContent} –

Verwandte Themen