我试图让Facebook SDK运行起来。我试图实现的唯一目标是验证激活,我没有使用登录,共享。每个安装步骤都已完成,但是当我检查分析时,它没有记录数据。有没有人知道为什么?
1)I downloaded the SDK。我将螺栓和核心文件拖到我的项目导航器中,然后在Build Settings中,我添加了框架的路径:
" /用户/戴夫/文档/杂项/ FacebookSDKs-IOS"
2)我使用我的App ID和Bundle ID在Facebook Developer页面上设置我的应用程序:
3)在同一页面上,我启用了单点登录:
4)"建立阶段",在" 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)在app委托文件中,我相信我有正确的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添加了一个&#34; Bridge-Header.h&#34;文件包含以下代码:
#ifndef Bridging_Header_h
#define Bridging_Header_h
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#endif /* Bridging_Header_h */
这就是......对吗?哪里有我的数据!?这就是我所看到的:
答案 0 :(得分:0)
在我的info.plist中发现它们是一个小错误:
我添加了&#34; FB&#34;我的应用ID的前缀(例如:&#34; FB1234567&#34;)。这对于顶部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>