2
votes

I'm trying to use Facebook sharing SDK in my iOS app.

I followed the steps in the Facebook Developer Website. But I have an issue, the problem is that Facebook is not showing the app name on posts published by my app as you can see in the screenshot below.

enter image description here

and I have some errors in the logs :

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

plugin com.apple.share.Facebook.post invalidated

but the photo is shared without any issue, the only problem is that there is not the app name on the post shared.

But when sharing a ContentLink I see the app name on the post, it doesn't work on photos !!

here is my code to share in 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>

Post shared with app name (it works on Android )

enter image description here

2
please share your info.plist fileUmair Afzal

2 Answers

1
votes

Why don't you use Social Framework to implement this ? Its very easy to implement and displays text, url , photo .

You just have to follow the below steps :- 1) Goto your app -> Build phases

2) Click on Link Binary with Libraries and add Social framework

3) In your View Controller import <Social/Social.h>

4) In your sharing action write the below code :-

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)
}

Else you can follow the below link for integration :-

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

To show your app link refer this :-

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

0
votes

Add the following items to your info.plist