我正在尝试使Facebook SDK正常工作。我要实现的唯一目标是验证激活,而不使用登录名和共享名。等等。每个安装步骤都已完成,但是当我检查分析数据时,它并没有记录数据。有谁知道为什么?
1)我昨天下载了SDK。我将螺栓和核心文件拖到项目导航器中,然后在“构建设置”中,将路径添加到框架:
“ /用户/戴夫/文档/其他/ FacebookSDKs-iOS”
2)我在Facebook开发人员页面上使用我的App ID和Bundle ID设置了我的应用程序:
3)在同一页面上,我启用了单点登录:
4)在“构建阶段”下的“使用库链接二进制文件”部分中,我看到了正确的文件:
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,所以我遵循了本教程,并使用以下代码添加了“ Bridge-Header.h”文件:
#ifndef Bridging_Header_h
#define Bridging_Header_h
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#endif /* Bridging_Header_h */
就这样...对吗?我的数据在哪里!这就是我所看到的:
发现他们是我的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>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句