【问题标题】:Not Receiving Data From Facebook iOS SDK未从 Facebook iOS SDK 接收数据
【发布时间】:2016-05-05 20:35:23
【问题描述】:

我正在尝试让 Facebook SDK 工作。我试图实现的唯一目标是验证激活,我没有使用登录、共享。等等。每个安装步骤都已完成,但是当我检查分析时,它没有记录数据。有人知道为什么吗?

如果需要,我的安装过程概述如下:

1) I downloaded the SDK 昨天。我将螺栓和核心文件拖到我的项目导航器中,然后在构建设置中,我添加了框架的路径:

"/Users/Dave/Documents/Misc/FacebookSDKs-iOS"

2) 我使用我的 App ID 和 Bundle ID 在Facebook Developer 页面上设置我的应用程序:

3) 在同一页面上,我启用了单点登录:

4) 在“Build Phases”下,在“Link Binary With Libraries”部分,我看到了正确的文件:

5) 在我的 info.plist 文件中,我也有它要求的所有代码:

<key>FacebookAppID</key>
<string>(my_FB-ID_IsHere)</string>
<key>FacebookDisplayName</key>
<string>(DisplayNameIsHere)</string>
<key>LSApplicationQueriesSchemes</key>
  <array>
      <string>fbapi</string>
      <string>fb-messenger-api</string>
      <string>fbauth2</string>
      <string>fbshareextension</string>
  </array>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <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>
        <key>akamaihd.net</key>
        <dict>
            <key>NSIncludesSubdomains</key> <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
        </dict>
    </dict>
</dict>

6) 添加代码后我的 info.plist 的图片:

7) 在应用程序委托文件中,我相信我有正确的 Swift 代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {        
    FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
    let settings = UIUserNotificationSettings(forTypes: [.Alert], categories: nil)
    UIApplication.sharedApplication().registerUserNotificationSettings(settings)
    return true
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}

//Other code...

func applicationDidBecomeActive(application: UIApplication) {
    FBSDKAppEvents.activateApp()
}

8) 因为我使用的是 Swift,所以我关注了this tutorial 并添加了一个带有以下代码的“Bridge-Header.h”文件:

#ifndef Bridging_Header_h
#define Bridging_Header_h 

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#endif /* Bridging_Header_h */

原来如此……对吧?我的数据呢!?这就是我所看到的:

【问题讨论】:

    标签: ios facebook-sdk-4.0


    【解决方案1】:

    发现他们是我的 info.plist 中的一个小错误:

    我在我的应用 ID 中添加了“FB”前缀(例如:“FB1234567”)。这对于顶部 ID 而不是底部 ID 是必需的:

    <key>CFBundleURLTypes</key>
    <array>
      <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>fb1234567</string>
      </array>
      </dict>
    </array>
    <key>FacebookAppID</key>
    <string>1234567</string>
    <key>FacebookDisplayName</key>
    <string>MyAppName</string>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      • 1970-01-01
      • 2021-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多