FBSDKShareDialog没有出现

时间:2017-10-23 08:18:55

标签: ios swift facebook fbsdksharedialog

我有显示对话框的功能:

class func showShareDialog(fromViewController viewController: UIViewController, shareContent: FBSDKSharingContent, mode: FBSDKShareDialogMode = FBSDKShareDialogMode.shareSheet) {
        let dialog = FBSDKShareDialog()
        dialog.fromViewController = viewController
        dialog.shareContent = shareContent
//        dialog.mode = mode
        dialog.show()
    }

我这样称呼这个方法:

let imageURL = URL(string: "http://www.greycloaktech.com/wp-content/uploads/2015/07/url-small.jpg")
        let content = FacebookManager.getShareContent(forLinkShare: imageURL, text: "That's the text to share on walls")
        FacebookManager.showShareDialog(fromViewController: self, shareContent: content)

顺便说一句,如果我将模式更改为dialog.mode = FBSDKShareDialogMode.browser,它会有效,所以问题只出现在FBSDKShareDialogMode.shareSheet

因为如果mode == FBSDKShareDialogMode.shareSheet我收到错误:

    2017-10-23 11:04:56.866625+0300 MyApp[1868:625813] -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2017-10-23 11:04:56.867029+0300 MyApp[1868:625813] [core] SLComposeViewController initWithServiceType: com.apple.social.facebook
2017-10-23 11:04:56.867151+0300 MyApp[1868:625813] [core] SLComposeViewController initWithServiceType got extension (null) for identifier com.apple.share.Facebook.post
2017-10-23 11:04:56.867243+0300 MyApp[1868:625813] [core] SLComposeViewController initWithExtension: (null) requestedServiceType: com.apple.social.facebook
2017-10-23 11:04:56.872994+0300 MyApp[1868:625813] -canOpenURL: failed for URL: "fbapi20150629:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2017-10-23 11:04:56.876269+0300 MyApp[1868:625813] -canOpenURL: failed for URL: "fbshareextension:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2017-10-23 11:04:56.876489+0300 MyApp[1868:625813] [core] addURL: start
2017-10-23 11:04:56.876911+0300 MyApp[1868:625813] [core] SLComposeViewController _addURL: http://www.greycloaktech.com/wp-content/uploads/2015/07/url-small.jpg type: 0 preview: (null)
2017-10-23 11:04:56.887705+0300 MyApp[1868:625813] [core] viewWillAppear
2017-10-23 11:04:56.892271+0300 MyApp[1868:625813] [core] viewDidAppear
2017-10-23 11:04:56.894247+0300 MyApp[1868:625813] [core] ViewDidAppear, but remote VC failed, dismissing
2017-10-23 11:04:56.895216+0300 MyApp[1868:625813] [core] Sheet not being presented, calling premature completion
2017-10-23 11:04:56.895326+0300 MyApp[1868:625813] [core] SLComposeViewController completeWithResult: 0
2017-10-23 11:04:56.895649+0300 MyApp[1868:625813] [core] SLComposeViewController automatically dismissing itself
2017-10-23 11:04:56.902158+0300 MyApp[1868:625813] [core] SLComposeViewController dealloc <SLComposeViewController: 0x105465350>

但如果我安装Facebook应用程序,一切正常,所以只有在没有安装Facebook应用程序的情况下才会出现问题

P.S。在plist文件中我有:

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbauth2</string>
        <string>fbapi</string>
        <string>fbapi20130214</string>
        <string>fbapi20130410</string>
        <string>fbapi20130702</string>
        <string>fbapi20131010</string>
        <string>fbapi20131219</string>
        <string>fbapi20140410</string>
        <string>fbapi20140116</string>
        <string>fbapi20150313</string>
        <string>fbapi20150629</string>
        <string>fbshareextension</string>
        <string>fb-messenger-api20140430</string>
        <string>fb-messenger-platform-20150128</string>
        <string>fb-messenger-platform-20150218</string>
        <string>fb-messenger-platform-20150305</string>
        <string>googlechromes</string>
        <string>comgooglemaps</string>
    </array>
<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSExceptionDomains</key>
        <dict>
            <key>akamaihd.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>facebook.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>fbcdn.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>

0 个答案:

没有答案