我正试图让Facebook SDK工作。 我试图实现的唯一目标是验证激活,我没有使用登录,共享。 每个安装步骤都已完成,但是当我检查分析时,它不会记录数据。 有没有人知道为什么?
如果需要,我的安装过程概述如下:
1) 我昨天下载了SDK 。 我将螺栓和核心文件拖到我的项目导航器中,然后在Build Settings中,我添加了框架的路径:
“/用户/戴维/文件/其它/ 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>If needed, my install process is outlined below:
1) I downloaded the SDK yesterday. I dragged the bolts and core files into my project navigator then, in the Build Settings, I've added the path to the framework:
"/Users/Dave/Documents/Misc/FacebookSDKs-iOS"
2) I setup my app on the Facebook Developer page with my App ID and Bundle ID:
3) On that same page I have single sign-on enabled:
4) Under "Build Phases", in the "Link Binary With Libraries" section, I see the right files:
5) In my info.plist file I also have all the code it requested:
<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) A picture of my info.plist after code was added:
7) In the app delegate file I believe I have the correct Swift code:
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) Because I'm using Swift, I followed this tutorial and added a "Bridge-Header.h" file with this code:
#ifndef Bridging_Header_h #define Bridging_Header_h #import <FBSDKCoreKit/FBSDKCoreKit.h> #endif /* Bridging_Header_h */So that's it... right? Where's my data!? This is all I see:
最满意答案
想知道他们在我的info.plist中是一个小错误:
我在应用程序ID中添加了“FB”前缀(例如:“FB1234567”)。 这对于顶部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>Figured out that their was a small error in my info.plist:
I had added the "FB" prefix to my app ID (for example: "FB1234567"). This is necessary for the top ID but not the bottom:
<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>更多推荐
发布评论