2016-05-22 22 views
1

iOSアプリでFacebook共有SDKを使用しようとしています。Facebook Share iOS Swift

私はFacebookデベロッパーウェブサイトの手順に従いました。しかし問題があります。問題は、下のスクリーンショットでわかるように、Facebookが自分のアプリから公開された投稿にアプリ名を表示していないことです。

enter image description here

と私は、ログに多少の誤差があります。

-canOpenURL: failed for URL: "fbapi20150629:/" - error: "This app is not allowed to query for scheme fbapi20150629"

plugin com.apple.share.Facebook.post invalidated

をが、写真はいかなる問題なく共有されている、唯一の問題は、共有ポストにアプリ名が存在しないということです。

しかし、ContentLinkを共有すると、投稿のアプリ名が表示されますが、写真では機能しません。ここ

は、iOSで共有するための私のコードです:

let image = UIImage(data:imageData!) 
let content: FBSDKSharePhotoContent = FBSDKSharePhotoContent() 
let photo: FBSDKSharePhoto = FBSDKSharePhoto() 
photo.image = image 
photo.userGenerated = true 
content.photos = [photo] 
FBSDKShareDialog.showFromViewController(self, withContent: content, delegate: nil) 

のInfo.plist:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
<plist version="1.0"> 
<dict> 
    <key>CFBundleDevelopmentRegion</key> 
    <string>fr_FR</string> 
    <key>CFBundleExecutable</key> 
    <string>$(EXECUTABLE_NAME)</string> 
    <key>CFBundleIdentifier</key> 
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> 
    <key>CFBundleInfoDictionaryVersion</key> 
    <string>6.0</string> 
    <key>CFBundleName</key> 
    <string>$(PRODUCT_NAME)</string> 
    <key>CFBundlePackageType</key> 
    <string>APPL</string> 
    <key>CFBundleShortVersionString</key> 
    <string>1.3.0</string> 
    <key>CFBundleSignature</key> 
    <string>????</string> 
    <key>CFBundleVersion</key> 
    <string>1</string> 
    <key>LSApplicationCategoryType</key> 
    <string></string> 
    <key>NSAppTransportSecurity</key> 

    <dict> 
     <key>NSAllowsArbitraryLoads</key> 
     <true/> 
    </dict> 
    <key>UIAppFonts</key> 
    <array> 
     <string>master_of_break.otf</string> 
    </array> 
    <key>UIBackgroundModes</key> 
    <array> 
     <string>remote-notification</string> 
    </array> 
    <key>UILaunchStoryboardName</key> 
    <string>LaunchScreen</string> 
    <key>UIMainStoryboardFile</key> 
    <string>Main</string> 
    <key>UIRequiredDeviceCapabilities</key> 
    <array> 
     <string>armv7</string> 
    </array> 
    <key>UIStatusBarStyle</key> 
    <string>UIStatusBarStyleLightContent</string> 
    <key>UISupportedInterfaceOrientations</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
    </array> 
    <key>UISupportedInterfaceOrientations~ipad</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
     <string>UIInterfaceOrientationPortraitUpsideDown</string> 
     <string>UIInterfaceOrientationLandscapeLeft</string> 
     <string>UIInterfaceOrientationLandscapeRight</string> 
    </array> 
    <key>CFBundleURLTypes</key> 
    <array> 
     <dict> 
      <key>CFBundleURLSchemes</key> 
      <array> 
       <string>fb100967589******</string> 
      </array> 
     </dict> 
    </array> 
    <key>FacebookAppID</key> 
    <string>100967589******</string> 
    <key>FacebookDisplayName</key> 
    <string>Athéna</string> 
    <key>LSApplicationQueriesSchemes</key> 
    <array> 
     <string>fbapi</string> 
     <string>fb-messenger-api</string> 
     <string>fbauth2</string> 
     <string>fbshareextension</string> 
    </array> 
</dict> 
</plist> 

ポストは

enter image description here

+0

あなたのInfo.plistファイルを共有してください –

答えて

0
(これは、Android上で動作)アプリ名と共有しました

info.plistに次の項目を追加してください

+0

私はすでにことを追加しました –

1

なぜこれを実装するためにソーシャルフレームワークを使用しないのですか?非常に簡単に実装し、テキスト、URL、写真を表示します。あなただけの、以下の手順に従う必要があり

: - 1)後藤あなたのアプリ - >段階

2の構築)ライブラリとリンクのバイナリをクリックして、社会の枠組みに

3を追加)あなたのビューコントローラであなたは他の

if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook) 
{ 
    let fbShare = SLComposeViewController(forServiceType: SLServiceTypeFacebook) 
    fbShare.setInitialText("Swift programming") 
    fbShare.addURL(NSURL(string: filePath)) 
    fbShare.addImage(UIImage(named:"ImageName")) 

    self.presentViewController(fbShare, animated: true, completion: nil) 
} 

- :あなたの共有アクションでインポート<Social/Social.h>

4)は、以下のコードを書きます統合のために、下のリンクをたどることができます: -

http://www.theappguruz.com/blog/facebook-integration-using-swift

アプリのリンクはこれを参照してください表示するには: -

https://developers.facebook.com/docs/applinks/ios